java.util.zip.DeflaterOutputStream
java.io.FilterOutputStream
java.util.zip.GZIPOutputStream, java.util.zip.ZipOutputStream
None
New as of JDK 1.1
The DeflaterOutputStream class represents an OutputStream with an associated Deflater. In other words, a DeflaterOutputStream wraps a regular output stream, so that data written to the stream is compressed and written to the underlying stream. Two subclasses, GZIPOutputStream and ZipOutputStream, write compressed data in widely-recognized formats.
public class java.util.zip.DeflaterOutputStream extends java.io.FilterOutputStream { // Variables protected byte[] buf; protected Deflater def; // Constructors public DeflaterOutputStream(OutputStream out); public DeflaterOutputStream(OutputStream out, Deflater def); public DeflaterOutputStream(OutputStream out, Deflater def, int size); // Public Instance Methods public void close(); public void finish(); public void write(int b); public void write(byte[] b, int off, int len); // Protected Instance Methods protected void deflate(); }
A buffer that holds the compressed data that is written to the underlying stream.
The Deflater object that is used internally.
The underlying output stream.
This constructor creates a DeflaterOutputStream that writes data to the given OutputStream. Before being written, the data is compressed by a default Deflater. The DeflaterOutputStream uses a compression buffer with the default size of 512 bytes.
The underlying output stream.
The Deflater object.
This constructor creates a DeflaterOutputStream that writes data to the given OutputStream. Before being written, the data is compressed by the given Deflater. The DeflaterOutputStream uses a compression buffer with the default size of 512 bytes.
public DeflaterOutputStream(OutputStream out, Deflater def, int size)
The underlying output stream.
The Deflater object.
The size of the output buffer.
This constructor creates a DeflaterOutputStream that writes data to the given OutputStream. Before being written, the data is compressed by the given Deflater. The DeflaterOutputStream uses a compression buffer of the given size.
If any kind of I/O error occurs.
FilterOutputStream.close()
This method closes the stream and releases any system resources that are associated with it.
If any kind of I/O error occurs.
This method finishes writing compressed data to the underlying stream without closing it.
The value to write.
If any kind of I/O error occurs.
FilterOutputStream.write(int)
This method compresses a byte that contains the lowest eight bits of the given integer value and writes it to the underlying OutputStream. The method blocks until the byte is written.
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.
FilterOutputStream.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.
If any kind of I/O error occurs.
This method asks the internal Deflater to compress the data in the buffer for this DeflaterOutputStream. The method then writes the compressed contents of the buffer to the underlying stream. The method is called by both write() methods.
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(byte[]) |
FilterOutputStream |
Deflater, FilterOutputStream, GZIPOutputStream, IOException, OutputStream, ZipOutputStream
This HTML Help has been published using the chm2web software. |