GZIPOutputStream class by allowing the configuration
of the compression level and the header metadata (file name, comment, modification time, operating system and extra flags).
| Modifier and Type | Field and Description |
|---|---|
| private boolean | closed
Indicates if the stream has been closed |
| private final CRC32 | crc
The checksum of the uncompressed data |
| private final byte[] | deflateBuffer
The buffer receiving the compressed data from the deflater |
| private final Deflater | deflater
Deflater used to compress the data |
| private static final int | FCOMMENT
Header flag indicating a comment follows the header |
| private static final int | FNAME
Header flag indicating a file name follows the header |
| private final OutputStream | out
The underlying stream |
| Access | Constructor and Description |
|---|---|
| public | GzipCompressorOutputStream(final OutputStream
the stream to compress to out)Creates a gzip compressed output stream with the default parameters. |
| public | GzipCompressorOutputStream(final OutputStream
the stream to compress to out, final GzipParameters the parameters to use parameters)Creates a gzip compressed output stream with the specified parameters. |
| Modifier and Type | Method and Description |
|---|---|
| public void | close()
Overrides java. Implements java. |
| private void | |
| public void | |
| public void | flush()
Overrides java. Implements java. |
| private byte[] | getBytes(final String
The string to encode. string)Gets the bytes encoded in the |
| public void | write(final byte[]
the data. buffer)Overrides java. b.length bytes from the specified byte array
to this output stream.
|
| public void | write(final byte[]
the data. buffer, final int the start offset in the data. offset, final int the number of bytes to write. length)Overrides java. len bytes from the specified byte array
starting at offset off to this output stream.
|
| public void | write(final int
the b)byte.Implements abstract java. |
| private void | |
| private void |
| closed | back to summary |
|---|---|
| private boolean closed Indicates if the stream has been closed | |
| crc | back to summary |
|---|---|
| private final CRC32 crc The checksum of the uncompressed data | |
| deflateBuffer | back to summary |
|---|---|
| private final byte[] deflateBuffer The buffer receiving the compressed data from the deflater | |
| deflater | back to summary |
|---|---|
| private final Deflater deflater Deflater used to compress the data | |
| FCOMMENT | back to summary |
|---|---|
| private static final int FCOMMENT Header flag indicating a comment follows the header | |
| FNAME | back to summary |
|---|---|
| private static final int FNAME Header flag indicating a file name follows the header | |
| out | back to summary |
|---|---|
| private final OutputStream out The underlying stream | |
| GzipCompressorOutputStream | back to summary |
|---|---|
| public GzipCompressorOutputStream(final OutputStream out) throws IOException Creates a gzip compressed output stream with the default parameters.
| |
| GzipCompressorOutputStream | back to summary |
|---|---|
| public GzipCompressorOutputStream(final OutputStream out, final GzipParameters parameters) throws IOException Creates a gzip compressed output stream with the specified parameters.
| |
| close | back to summary |
|---|---|
| public void close() throws IOException Overrides java. Implements java. Doc from java. Closes this output stream and releases any system resources
associated with this stream. The general contract of
| |
| deflate | back to summary |
|---|---|
| private void deflate() throws IOException | |
| finish | back to summary |
|---|---|
| public void finish() throws IOException Finishes writing compressed data to the underlying stream without closing it.
| |
| flush | back to summary |
|---|---|
| public void flush() throws IOException Overrides java. Implements java. Doc from java. Flushes this output stream and forces any buffered output bytes
to be written out. The general contract of If the intended destination of this stream is an abstraction provided by the underlying operating system, for example a file, then flushing the stream guarantees only that bytes previously written to the stream are passed to the operating system for writing; it does not guarantee that they are actually written to a physical device such as a disk drive.
| |
| getBytes | back to summary |
|---|---|
| private byte[] getBytes(final String string) throws IOException Gets the bytes encoded in the
If the string cannot be encoded directly with
| |
| write | back to summary |
|---|---|
| public void write(final byte[] buffer) throws IOException Overrides java. Doc from java. Writes
| |
| write | back to summary |
|---|---|
| public void write(final byte[] buffer, final int offset, final int length) throws IOException Overrides java. Doc from java. Writes
If
If
| |
| write | back to summary |
|---|---|
| public void write(final int b) throws IOException Implements abstract java. Doc from java. Writes the specified byte to this output stream. The general
contract for
| |
| writeHeader | back to summary |
|---|---|
| private void writeHeader(final GzipParameters parameters) throws IOException | |
| writeTrailer | back to summary |
|---|---|
| private void writeTrailer() throws IOException | |