public class DeflaterInputStream extends FilterInputStream
DeflaterOutputStream,
InflaterOutputStream,
InflaterInputStream
| Modifier and Type | Field and Description |
|---|---|
protected byte[] |
buf
Input buffer for reading compressed data.
|
protected Deflater |
def
Compressor for this stream.
|
in| Constructor and Description |
|---|
DeflaterInputStream(InputStream
Creates a new input stream with a default compressor and buffer size.
|
DeflaterInputStream(InputStream
Creates a new input stream with the specified compressor and a default buffer size.
|
DeflaterInputStream(InputStream
Creates a new input stream with the specified compressor and buffer size.
|
| Modifier and Type | Method and Description |
|---|---|
int |
available()
Returns 0 after EOF has been reached, otherwise always return 1.
|
void |
close()
Closes this input stream and its underlying input stream, discarding any pending uncompressed data.
|
void |
mark(int limit)
This operation is not supported.
|
boolean |
markSupported()
|
int |
read()
Reads a single byte of compressed data from the input stream.
|
int |
read(byte[] b, int off, int len)
Reads compressed data into a byte array.
|
void |
reset()
This operation is not supported.
|
long |
skip(long n)
Skips over and discards data from the input stream.
|
readprotected final Deflaterdef
protected final byte[] buf
public DeflaterInputStream(InputStreamin)
in - input stream to read the uncompressed data to
NullPointerException - if
in is null
public DeflaterInputStream(InputStreamin, Deflater defl)
in - input stream to read the uncompressed data to
defl - compressor ("deflater") for this stream
NullPointerException - if
in or
defl is null
public DeflaterInputStream(InputStreamin, Deflater defl, int bufLen)
in - input stream to read the uncompressed data to
defl - compressor ("deflater") for this stream
bufLen - compression buffer size
IllegalArgumentException - if
bufLen <= 0
NullPointerException - if
in or
defl is null
public void close()
throws IOException
close in interface
Closeable
close in interface
AutoCloseable
close in class
FilterInputStream
IOException - if an I/O error occurs
FilterInputStream.in
public int read()
throws IOException
read in class
FilterInputStream
IOException - if an I/O error occurs or if this stream is already closed
FilterInputStream.in
public int read(byte[] b,
int off,
int len)
throws IOException
read in class
FilterInputStream
b - buffer into which the data is read
off - starting offset of the data within
b
len - maximum number of compressed bytes to read into
b
IndexOutOfBoundsException - if
len > b.length - off
IOException - if an I/O error occurs or if this input stream is already closed
FilterInputStream.in
public long skip(long n)
throws IOException
n is given as a
long, the maximum number of bytes which can be skipped is
Integer.MAX_VALUE.
skip in class
FilterInputStream
n - number of bytes to be skipped
IOException - if an I/O error occurs or if this stream is already closed
public int available()
throws IOException
Programs should not count on this method to return the actual number of bytes that could be read without blocking
available in class
FilterInputStream
IOException - if an I/O error occurs or if this stream is already closed
public boolean markSupported()
markSupported in class
FilterInputStream
FilterInputStream.in ,
InputStream.mark(int) ,
InputStream.reset()
public void mark(int limit)
mark in class
FilterInputStream
limit - maximum bytes that can be read before invalidating the position marker
FilterInputStream.in ,
FilterInputStream.reset()
public void reset()
throws IOException
reset in class
FilterInputStream
IOException - always thrown
FilterInputStream.in ,
FilterInputStream.mark(int)