Compress an InputStream with gzip

前端 未结 12 1418
迷失自我
迷失自我 2020-12-29 05:28

I would like to compress an input stream in java using Gzip compression.

Let\'s say we have an input stream (1GB of data..) not compressed. I want as a result a comp

12条回答
  •  遥遥无期
    2020-12-29 06:11

    A working example of a compressing input stream can be found in the popular open source ESB Mule: GZIPCompressorInputStream.

    It uses the DeflaterInputStream provided by the JRE for compression, prepends the gzip header and appends the gzip trailer (aka footer).

    Unfortunately, it is under CPA License, which does not seem to be very common. In addition, there seems to be no unit test.

提交回复
热议问题