java.util.zip.GZIPOutputStream
java.util.zip.DeflaterOutputStream
None
None
New as of JDK 1.1
The GZIPOutputStream class compresses data using the GZIP format. To use it, simply construct a GZIPOutputStream that wraps a regular output stream and use the write() methods to write compressed data.
public class java.util.zip.GZIPOutputStream extends java.util.zip.DeflaterOutputStream { // Variables protected CRC32 crc; // Constructors public GZIPOutputStream(OutputStream out); public GZIPOutputStream(OutputStream out, int size); // Instance Methods public void close(); public void finish(); public synchronized void write(byte[] buf, int off, int len); }
A checksum that is updated with the uncompressed stream data. The checksum value is written into the GZIP trailer.
The underlying output stream.
If an error occurs while writing the GZIP header.
This constructor creates a GZIPOutputStream that writes compressed data to the given OutputStream. The GZIPOutputStream uses a compression buffer with the default size of 512 bytes.
public GZIPOutputStream(OutputStream out, int size) throws IOException
The underlying output stream.
The size of the output buffer.
If an error occurs while writing the GZIP header.
This constructor creates a GZIPOutputStream that writes compressed data to the given OutputStream. The GZIPOutputStream uses a compression buffer of the given size.
If any kind of I/O error occurs.
DeflaterOutputStream.close()
This method closes the stream and releases any system resources that are associated with it.
If any kind of I/O error occurs.
DeflaterOutputStream.finish()
This method finishes writing compressed data to the underlying stream without closing it.
An array of bytes to write to the stream.
An offset into the byte array.
The number of bytes to write.
If any kind of I/O error occurs.
DeflaterOutputStream.write(byte[], int, int)
This method takes len bytes from the given buffer, starting at off, and compresses them. The method then writes the compressed data to the underlying OutputStream. The method blocks until all of the bytes have been written.
Method |
Inherited From |
Method |
Inherited From |
---|---|---|---|
clone() |
Object |
equals(Object) |
Object |
finalize() |
Object |
flush() |
FilterOutputStream |
getClass() |
Object |
hashCode() |
Object |
notify() |
Object |
notifyAll() |
Object |
toString() |
Object |
wait() |
Object |
wait(long) |
Object |
wait(long, int) |
Object |
write(int) |
DeflaterOutputStream |
write(byte[]) |
FilterOutputStream |
Deflater, DeflaterOutputStream, FilterOutputStream, IOException, OutputStream