Package net.sf.jazzlib
Class InflaterInputStream
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
net.sf.jazzlib.InflaterInputStream
- All Implemented Interfaces:
Closeable,AutoCloseable
- Direct Known Subclasses:
GZIPInputStream,ZipInputStream
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
FieldsModifier and TypeFieldDescriptionprotected byte[]Byte array used as a bufferprotected InflaterDecompressor for this filterprotected intSize of bufferprivate final byte[]Fields inherited from class java.io.FilterInputStream
in -
Constructor Summary
ConstructorsConstructorDescriptionCreate 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
Modifier and TypeMethodDescriptionintReturns 0 once the end of the stream (EOF) has been reached.voidclose()Closes the input streamprotected voidfill()Fills the buffer with more data to decompress.intread()Reads one byte of decompressed data.intread(byte[] b, int off, int len) Decompresses data into the byte arraylongskip(long n) Skip specified number of bytes of uncompressed dataMethods inherited from class java.io.FilterInputStream
mark, markSupported, read, resetMethods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Field Details
-
inf
Decompressor for this filter -
buf
protected byte[] bufByte array used as a buffer -
len
protected int lenSize of buffer -
onebytebuffer
private final byte[] onebytebuffer
-
-
Constructor Details
-
InflaterInputStream
Create an InflaterInputStream with the default decompresseor and a default buffer size.- Parameters:
in- the InputStream to read bytes from
-
InflaterInputStream
Create an InflaterInputStream with the specified decompresseor and a default buffer size.- Parameters:
in- the InputStream to read bytes frominf- the decompressor used to decompress data read from in
-
InflaterInputStream
Create an InflaterInputStream with the specified decompresseor and a specified buffer size.- Parameters:
in- the InputStream to read bytes frominf- the decompressor used to decompress data read from insize- size of the buffer to use
-
-
Method Details
-
available
Returns 0 once the end of the stream (EOF) has been reached. Otherwise returns 1.- Overrides:
availablein classFilterInputStream- Throws:
IOException
-
close
Closes the input stream- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classFilterInputStream- Throws:
IOException
-
fill
Fills the buffer with more data to decompress.- Throws:
IOException
-
read
Reads one byte of decompressed data. The byte is in the lower 8 bits of the int.- Overrides:
readin classFilterInputStream- Throws:
IOException
-
read
Decompresses data into the byte array- Overrides:
readin classFilterInputStream- Parameters:
b- the array to read and decompress data intooff- the offset indicating where the data should be placedlen- the number of bytes to decompress- Throws:
IOException
-
skip
Skip specified number of bytes of uncompressed data- Overrides:
skipin classFilterInputStream- Parameters:
n- number of bytes to skip- Throws:
IOException
-