Spring-core 5.2 have codec package with decoder such as StringDecoder
that support reactive programing. the API get Publisher<DataBuffer>
and return decoded Flux<String>
.
I was hoping to find GzipDecoder that get Publisher<DataBuffer>
or Publisher<ByteArray>
of gzip and return uncomperesed Flux<ByteArray>
but i didn't find it.
the only library that i find that match my requirement is https://github.com/kptfh/gzip-reactive but it very immature
any familiar with mature code?
I found out that the project above copy the code from org.eclipse.jetty.http.GZIPContentDecoder
i add the dependency below (managed by spring boot)
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-http</artifactId>
</dependency>
and using the decode method in map function example:
GZIPContentDecoder decoder = new GZIPContentDecoder(2048);
return Flux.from(input).map(decoder::decode)
.doFinally(signalType -> decoder.destroy());