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
There is no DeflatingGZIPInputStream in the JRE. To deflate with the "deflate" compression format, use java.util.zip.DeflaterInputStream and java.util.zip.DeflaterOutputStream:
public InputStream getCompressedStream(InputStream unCompressedStream) {
return new DeflaterInputStream(unCompressedStream);
}
You could derive a class from java.util.zip.DeflaterInputStream that deflates in GZIP format by looking at the the source of java.util.zip.GZIPOutputStream.