java.util.zip
Class GZIPOutputStream
java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
java.util.zip.DeflaterOutputStream
java.util.zip.GZIPOutputStream
- All Implemented Interfaces:
- Closeable, Flushable
public class GZIPOutputStream
- extends DeflaterOutputStream
The GZIPOutputStream class is used to write data to a stream in the GZIP
storage format.
|
Method Summary |
void |
finish()
Indicates to the stream that all data has been written out, and any GZIP
terminal data can now be output. |
void |
write(byte[] buffer,
int off,
int nbytes)
Write up to nbytes of data from buf, starting at offset off, to the
underlying stream in GZIP format. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
crc
protected CRC32 crc
GZIPOutputStream
public GZIPOutputStream(OutputStream os)
throws IOException
- Construct a new GZIPOutputStream to write data in GZIP format to the
underlying stream.
- Parameters:
os - OutputStream to write to
- Throws:
IOException
GZIPOutputStream
public GZIPOutputStream(OutputStream os,
int size)
throws IOException
- Construct a new GZIPOutputStream to write data in GZIP format to the
underlying stream. Set the internal compression buffer to sise size.
- Parameters:
os - OutputStream to write tosize - Internal buffer size
- Throws:
IOException
finish
public void finish()
throws IOException
- Indicates to the stream that all data has been written out, and any GZIP
terminal data can now be output.
- Overrides:
finish in class DeflaterOutputStream
- Throws:
IOException - If an error occurs.
write
public void write(byte[] buffer,
int off,
int nbytes)
throws IOException
- Write up to nbytes of data from buf, starting at offset off, to the
underlying stream in GZIP format.
- Overrides:
write in class DeflaterOutputStream
- Parameters:
buffer - Buffer of data to compressoff - offset in buffer to extract data fromnbytes - Number of bytes of data to compress and write
- Throws:
IOException - If an error occurs attempting to write to this
FilterOutputStream.
Please submit a feedback, bug or feature