java.util.zip

Class InflaterInputStream

public class InflaterInputStream extends FilterInputStream

This filter stream is used to decompress data compressed in the "deflate" format. The "deflate" format is described in RFC 1951. This stream may form the basis for other decompression filters, such as the GZIPInputStream.

Since: 1.1

Field Summary
protected byte[]buf
Byte array used as a buffer
protected Inflaterinf
Decompressor for this filter
protected intlen
Size of buffer
Constructor Summary
InflaterInputStream(InputStream in)
Create an InflaterInputStream with the default decompresseor and a default buffer size.
InflaterInputStream(InputStream in, Inflater inf)
Create an InflaterInputStream with the specified decompresseor and a default buffer size.
InflaterInputStream(InputStream in, Inflater inf, int size)
Create an InflaterInputStream with the specified decompresseor and a specified buffer size.
Method Summary
intavailable()
Returns 0 once the end of the stream (EOF) has been reached.
voidclose()
Closes the input stream
protected voidfill()
Fills the buffer with more data to decompress.
voidmark(int readLimit)
booleanmarkSupported()
intread()
Reads one byte of decompressed data.
intread(byte[] b, int off, int len)
Decompresses data into the byte array
voidreset()
longskip(long n)
Skip specified number of bytes of uncompressed data

Field Detail

buf

protected byte[] buf
Byte array used as a buffer

inf

protected Inflater inf
Decompressor for this filter

len

protected int len
Size of buffer

Constructor Detail

InflaterInputStream

public InflaterInputStream(InputStream in)
Create an InflaterInputStream with the default decompresseor and a default buffer size.

Parameters: in the InputStream to read bytes from

InflaterInputStream

public InflaterInputStream(InputStream in, Inflater inf)
Create an InflaterInputStream with the specified decompresseor and a default buffer size.

Parameters: in the InputStream to read bytes from inf the decompressor used to decompress data read from in

InflaterInputStream

public InflaterInputStream(InputStream in, Inflater inf, int size)
Create an InflaterInputStream with the specified decompresseor and a specified buffer size.

Parameters: in the InputStream to read bytes from inf the decompressor used to decompress data read from in size size of the buffer to use

Method Detail

available

public int available()
Returns 0 once the end of the stream (EOF) has been reached. Otherwise returns 1.

close

public void close()
Closes the input stream

fill

protected void fill()
Fills the buffer with more data to decompress.

mark

public void mark(int readLimit)

markSupported

public boolean markSupported()

read

public int read()
Reads one byte of decompressed data. The byte is in the lower 8 bits of the int.

read

public int read(byte[] b, int off, int len)
Decompresses data into the byte array

Parameters: b the array to read and decompress data into off the offset indicating where the data should be placed len the number of bytes to decompress

reset

public void reset()

skip

public long skip(long n)
Skip specified number of bytes of uncompressed data

Parameters: n number of bytes to skip