Introduction
The java.util.zip.GZIPOutputStream class implements a stream filter for writing compressed data in the GZIP file format.
Class Declaration
Following is the declaration for java.util.zip.GZIPOutputStream class −
publicclassGZIPOutputStreamextendsDeflaterOutputStream
Learn Java in-depth with real-world projects through our Java certification course. Enroll and become a certified expert to boost your career.
Fields
Following are the fields for java.util.zip.GZIPOutputStream class −
- Protected CRC32 crc − CRC-32 for uncompressed data.
Constructors
Sr.No. | Constructor & Description |
---|---|
1 | GZIPOutputStream(OutputStream out)Creates a new output stream with a default buffer size. |
2 | GZIPOutputStream(OutputStream out, boolean syncFlush)Creates a new output stream with a default buffer size and the specified flush mode. |
3 | GZIPOutputStream(OutputStream out, int size)Creates a new output stream with the specified buffer size. |
4 | GZIPOutputStream(OutputStream out, int size, boolean syncFlush)Creates a new output stream with the specified buffer size and flush mode. |
Class Methods
Sr.No. | Method & Description |
---|---|
1 | void finish()Finishes writing compressed data to the output stream without closing the underlying stream. |
2 | int write(byte[] buf, int off, int len)Writes array of bytes to the compressed output stream. |
Methods Inherited
This class inherits methods from the following classes −
- java.util.zip.DeflaterOutputStream
- java.io.FilterOutputStream
- java.lang.Object
Leave a Reply