public class InflaterOutputStream extends FilterOutputStream
OutputStream filter to decompress data. Callers write
compressed data in the "deflate" format, and uncompressed data is
written to the underlying stream.| Modifier and Type | Field and Description |
|---|---|
protected byte[] |
buf |
protected Inflater |
inf |
out| Constructor and Description |
|---|
InflaterOutputStream(OutputStream out)
Constructs an
InflaterOutputStream with a new Inflater and an
implementation-defined default internal buffer size. |
InflaterOutputStream(OutputStream out,
Inflater inf)
Constructs an
InflaterOutputStream with the given Inflater and an
implementation-defined default internal buffer size. |
InflaterOutputStream(OutputStream out,
Inflater inf,
int bufferSize)
Constructs an
InflaterOutputStream with the given Inflater and
given internal buffer size. |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Writes remaining data into the output stream and closes the underlying
output stream.
|
void |
finish()
Finishes writing current uncompressed data into the InflaterOutputStream
without closing it.
|
void |
flush()
Ensures that all pending data is sent out to the target stream.
|
void |
write(byte[] bytes,
int offset,
int byteCount)
Writes to the decompressing output stream.
|
void |
write(int b)
Writes a byte to the decompressing output stream.
|
nullOutputStream, writeprotected final Inflater inf
protected final byte[] buf
public InflaterOutputStream(OutputStream out)
InflaterOutputStream with a new Inflater and an
implementation-defined default internal buffer size. out is a destination
for uncompressed data, and compressed data will be written to this stream.out - the destination OutputStreampublic InflaterOutputStream(OutputStream out, Inflater inf)
InflaterOutputStream with the given Inflater and an
implementation-defined default internal buffer size. out is a destination
for uncompressed data, and compressed data will be written to this stream.out - the destination OutputStreaminf - the Inflater to be used for decompressionpublic InflaterOutputStream(OutputStream out, Inflater inf, int bufferSize)
InflaterOutputStream with the given Inflater and
given internal buffer size. out is a destination
for uncompressed data, and compressed data will be written to this stream.out - the destination OutputStreaminf - the Inflater to be used for decompressionbufferSize - the length in bytes of the internal bufferpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class FilterOutputStreamIOException - if an error occurs attempting to close this stream.public void flush()
throws IOException
FilterOutputStreamflush in interface Flushableflush in class FilterOutputStreamIOException - if an error occurs attempting to flush this stream.public void finish()
throws IOException
IOException - if an I/O error occurs, or the stream has been closedpublic void write(int b)
throws IOException,
ZipException
b should be a byte of
compressed input. The corresponding uncompressed data will be written to the underlying
stream.write in class FilterOutputStreamb - the byteIOException - if an I/O error occurs, or the stream has been closedZipException - if a zip exception occurs.public void write(byte[] bytes,
int offset,
int byteCount)
throws IOException,
ZipException
bytes array should contain
compressed input. The corresponding uncompressed data will be written to the underlying
stream.write in class FilterOutputStreambytes - the buffer to write.offset - the index of the first byte in buffer to write.byteCount - the number of bytes in buffer to write.IOException - if an I/O error occurs, or the stream has been closedZipException - if a zip exception occurs.NullPointerException - if b == null.IndexOutOfBoundsException - if off < 0 || len < 0 || off + len > b.length