DeflaterInputStream created without
specifying a compressor will create a compressor
at construction time, and close the compressor when the input stream
is closed.
If a compressor is specified when creating a DeflaterInputStream, it is the
responsibility of the caller to close the
compressor after closing the input stream.
API Note
The close method should be called to release resources used by this
stream, either directly, or with the try-with-resources statement.
DeflaterOutputStream, InflaterOutputStream, InflaterInputStream
| Modifier and Type | Field and Description |
|---|---|
| protected final byte[] | buf
Input buffer for reading compressed data. |
| protected final Deflater | def
Compressor for this stream. |
| private byte[] | rbuf
Temporary read buffer. |
| private boolean | reachEOF
End of the underlying input stream has been reached. |
| private boolean | usesDefaultDeflater
Default compressor is used. |
| Access | Constructor and Description |
|---|---|
| public | DeflaterInputStream(InputStream
input stream to read the uncompressed data to in)Creates a new input stream and compressor with the default compression level and a default buffer size. |
| public | DeflaterInputStream(InputStream
input stream to read the uncompressed data to in, Deflater compressor ("deflater") for this stream defl)Creates a new input stream with the specified compressor and a default buffer size. |
| public | DeflaterInputStream(InputStream
input stream to read the uncompressed data to in, Deflater compressor ("deflater") for this stream defl, int compression buffer size bufLen)Creates a new input stream with the specified compressor and buffer size. |
| Modifier and Type | Method and Description |
|---|---|
| public int | Returns: zero after the end of the underlying input stream has been reached, otherwise always returns 1Overrides java. Returns 0 after EOF has been reached, otherwise always return 1. |
| public void | close()
Overrides java. Implements java. Closes this input stream and its underlying input stream, discarding any pending uncompressed data. |
| private void | |
| public void | mark(int
maximum bytes that can be read before invalidating the position marker limit)Overrides java. This operation is not supported. |
| public boolean | Returns: false, alwaysOverrides java. Always returns |
| public int | Returns: a single byte of compressed data, or -1 if the end of the uncompressed input stream is reachedOverrides java. Reads a single byte of compressed data from the input stream. |
| public int | Returns: the actual number of bytes read, or -1 if the end of the uncompressed input stream is reachedbuffer into which the data is read b, int starting offset of the data within off, int bmaximum number of compressed bytes to read into len)bOverrides java. Reads compressed data into a byte array. |
| public void | |
| public long | Returns: the actual number of bytes skipped, which might be zeronumber of bytes to be skipped. If n)n is zero then no bytes are skipped.Overrides java. Skips over and discards data from the input stream. |
| buf | back to summary |
|---|---|
| protected final byte[] buf Input buffer for reading compressed data. | |
| def | back to summary |
|---|---|
| protected final Deflater def Compressor for this stream. | |
| rbuf | back to summary |
|---|---|
| private byte[] rbuf Temporary read buffer. | |
| reachEOF | back to summary |
|---|---|
| private boolean reachEOF End of the underlying input stream has been reached. | |
| usesDefaultDeflater | back to summary |
|---|---|
| private boolean usesDefaultDeflater Default compressor is used. | |
| DeflaterInputStream | back to summary |
|---|---|
| public DeflaterInputStream(InputStream in) Creates a new input stream and compressor with the default compression level and a default buffer size. The compressor will be closed when this input stream is closed.
| |
| DeflaterInputStream | back to summary |
|---|---|
| public DeflaterInputStream(InputStream in, Deflater defl) Creates a new input stream with the specified compressor and a default buffer size. Closing this input stream will not close the given compressor.
| |
| DeflaterInputStream | back to summary |
|---|---|
| public DeflaterInputStream(InputStream in, Deflater defl, int bufLen) Creates a new input stream with the specified compressor and buffer size. Closing this input stream will not close the given compressor.
| |
| available | back to summary |
|---|---|
| public int available() throws IOException Overrides java. Returns 0 after EOF has been reached, otherwise always return 1. Programs should not count on this method to return the actual number of bytes that could be read without blocking
| |
| close | back to summary |
|---|---|
| public void close() throws IOException Overrides java. Implements java. Closes this input stream and its underlying input stream, discarding any pending uncompressed data.
| |
| ensureOpen | back to summary |
|---|---|
| private void ensureOpen() throws IOException Check to make sure that this stream has not been closed. | |
| mark | back to summary |
|---|---|
| public void mark(int limit) Overrides java. This operation is not supported.
| |
| markSupported | back to summary |
|---|---|
| public boolean markSupported() Overrides java. Always returns
| |
| read | back to summary |
|---|---|
| public int read() throws IOException Overrides java. Reads a single byte of compressed data from the input stream. This method will block until some input can be read and compressed.
| |
| read | back to summary |
|---|---|
| public int read(byte[] b, int off, int len) throws IOException Overrides java. Reads compressed data into a byte array. This method will block until some input can be read and compressed.
| |
| reset | back to summary |
|---|---|
| public void reset() throws IOException Overrides java. This operation is not supported.
| |
| skip | back to summary |
|---|---|
| public long skip(long n) throws IOException Overrides java. Skips over and discards data from the input stream. This method may block until the specified number of bytes are skipped or end of stream is reached. Implementation Note This method skips at most
| |