public class GZIPOutputStream extends DeflaterOutputStream
Modifier and Type | Field and Description |
---|---|
protected CRC32 |
crc
CRC-32 value for uncompressed data
|
buf, def
out
Constructor and Description |
---|
GZIPOutputStream(OutputStream out)
Creates a GZIPOutputStream with the default buffer size
|
GZIPOutputStream(OutputStream out,
int size)
Creates a GZIPOutputStream with the specified buffer size
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Writes remaining compressed output data to the output stream
and closes it.
|
void |
finish()
Finishes the stream by calling finish() on the deflater.
|
void |
write(byte[] buf,
int off,
int len)
Writes a len bytes from an array to the compressed stream.
|
deflate, flush, write
write
public GZIPOutputStream(OutputStream out) throws IOException
out
- The stream to read data (to be compressed) fromIOException
public GZIPOutputStream(OutputStream out, int size) throws IOException
out
- The stream to read compressed data fromsize
- Size of the buffer to useIOException
public void write(byte[] buf, int off, int len) throws IOException
DeflaterOutputStream
write
in class DeflaterOutputStream
buf
- the byte array.off
- the offset into the byte array where to start.len
- the number of bytes to write.IOException
- If an error occurspublic void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class DeflaterOutputStream
IOException
- If an error occurspublic void finish() throws IOException
DeflaterOutputStream
finish
in class DeflaterOutputStream
IOException