See Also: GZIPOutputStream Members
The GZIPOutputStream class is used to write data to a stream in the GZIP storage format.
Using GZIPOutputStream is a little easier than Java.Util.Zip.ZipOutputStream because GZIP is only for compression, and is not a container for multiple files. This code creates a GZIP stream, similar to the gzip(1) utility.
java Example
OutputStream os = ...
byte[] bytes = ...
GZIPOutputStream zos = new GZIPOutputStream(new BufferedOutputStream(os));
try {
zos.write(bytes);
} finally {
zos.close();
}