On Fri, Nov 23, 2018 at 8:17 PM <[email protected]> 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.
