java.util.zip
public
class
java.util.zip.DeflaterOutputStream
The DeflaterOutputStream class implements a stream filter for the writing of
compressed data to a stream. Compression is performed by an instance of
Deflater.
Known Direct Subclasses
GZIPOutputStream |
The GZIPOutputStream class is used to write data to a stream in the GZIP
storage format. |
ZipOutputStream |
ZipOutputStream is used to write ZipEntries to the underlying stream. |
Known Indirect Subclasses
JarOutputStream |
The JarOutputStream is used to output data in JarFile format. |
Summary
Fields
Public Constructors
Public Methods
Protected Methods
|
|
|
|
|
void |
close() |
|
|
|
|
|
void |
flush() |
|
|
|
|
|
void |
write(byte[] buffer) |
abstract |
|
|
|
|
void |
write(int oneByte) |
|
|
|
|
|
void |
write(byte[] buffer, int offset, int count) |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
Details
Fields
Public Constructors
Constructs a new DeflaterOutputStream instance using os as the underlying
stream. The provided Deflater instance will be used to compress data.
Parameters
os
| OutputStream to receive compressed data |
def
| Deflater to perform compression
|
public
DeflaterOutputStream(OutputStream os)
Constructs a new DeflaterOutputStream instance using os as the underlying
stream.
Parameters
os
| OutputStream to receive compressed data
|
public
DeflaterOutputStream(OutputStream os, Deflater def, int bsize)
Constructs a new DeflaterOutputStream instance using os as the underlying
stream. The provided Deflater instance will be used to compress data. The
internal buffer for storing compressed data will be of size bsize.
Parameters
os
| OutputStream to receive compressed data |
def
| Deflater to perform compression |
bsize
| size of internal compression buffer
|
Public Methods
public
void
close()
Writes any unwritten compressed data to the underlying stream, the closes
all underlying streams. This stream can no longer be used after close()
has been called.
public
void
finish()
Write any unwritten data to the underlying stream. Do not close the
stream. This allows subsequent Deflater's to write to the same stream.
This Deflater cannot be used again.
public
void
write(int i)
Writes the specified byte
oneByte
to this
FilterOutputStream. Only the low order byte of
oneByte
is
written. This implementation writes the byte to the target OutputStream.
public
void
write(byte[] buffer, int off, int nbytes)
Compress nbytes of data from buf starting at off and write it to the
underlying stream.
Parameters
buffer
| Buffer of data to compress |
off
| offset in buffer to extract data from |
nbytes
| Number of bytes of data to compress and write |
Protected Methods
protected
void
deflate()
Compress the data in the input buffer and write it to the underlying
stream.