Hi Tatu,

This looks exactly like what I need, I know this is not a responsibility of 
the *ObjectMapper* but the 3rd party API isn't giving me much freedom so I 
cannot compress myself,
I'm wondering if I can decorate the *SmileFactory* using this approach? As 
the SmileFactory without the extra string compression is the fastest of the 
bunch.
Also, are there examples on how to use these Input/Output decorators, 
thanks a lot for answering as this is a huge step towards the solution.

Guido.

On Saturday, November 24, 2018 at 4:37:54 AM UTC, Tatu Saloranta wrote:
>
> On Fri, Nov 23, 2018 at 8:17 PM <[email protected] <javascript:>> wrote: 
> > 
> > Hi, 
> > 
> > I have been scratching my head for the last hour or two looking for a 
> Gzip JsonFactory or any other type of factory that is able to compress huge 
> Json objects, 
> > I know I'm going to sacrifice some performance but for this particular 
> scenario I need a JsonFactory -or ObjectMapper- that is able to gzip. 
> > Is there any opensource project that has that done already? or what 
> would be the simplest way to write one? 
> > I could gzip the output of the ObjectMapper but this is not an option 
> before I'm using a 3rd party framework that requires me to pass an 
> ObjectMapper 
>
> This sort of falls outside realm of ObjectMapper in my opinion (and 
> why just gzip? Snappy, lz4, bz2, there's plethora of compression 
> codecs to support). 
>
> But there is one extension point in JsonFactory (part of `jackson-core`): 
>
> JsonFactory.setOutputDecorator(OutputDecorator decoratorImpl); 
>
> which you can use to install a decorator that will add compression 
> codec into `OutputStream` when `decorate(OutputStream)` method is 
> called. 
> So you can construct and configure `JsonFactory`, construct 
> `ObjectMapper` with it, and that should allow you to add compression. 
>
> I hope this helps, 
>
> -+ Tatu +- 
>

-- 
You received this message because you are subscribed to the Google Groups 
"jackson-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to