Package net.sf.jazzlib
Class InflaterInputStream
- java.lang.Object
-
- java.io.InputStream
-
- java.io.FilterInputStream
-
- net.sf.jazzlib.InflaterInputStream
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
- Direct Known Subclasses:
GZIPInputStream,ZipInputStream
public class InflaterInputStream extends java.io.FilterInputStreamThis 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 theGZIPInputStream.- Since:
- 1.1
-
-
Field Summary
Fields Modifier and Type Field Description protected byte[]bufByte array used as a bufferprotected InflaterinfDecompressor for this filterprotected intlenSize of bufferprivate byte[]onebytebuffer
-
Constructor Summary
Constructors Constructor Description InflaterInputStream(java.io.InputStream in)Create an InflaterInputStream with the default decompresseor and a default buffer size.InflaterInputStream(java.io.InputStream in, Inflater inf)Create an InflaterInputStream with the specified decompresseor and a default buffer size.InflaterInputStream(java.io.InputStream in, Inflater inf, int size)Create an InflaterInputStream with the specified decompresseor and a specified buffer size.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intavailable()Returns 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 data
-
-
-
Field Detail
-
inf
protected Inflater inf
Decompressor for this filter
-
buf
protected byte[] buf
Byte array used as a buffer
-
len
protected int len
Size of buffer
-
onebytebuffer
private final byte[] onebytebuffer
-
-
Constructor Detail
-
InflaterInputStream
public InflaterInputStream(java.io.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(java.io.InputStream in, Inflater inf)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
public InflaterInputStream(java.io.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 frominf- the decompressor used to decompress data read from insize- size of the buffer to use
-
-
Method Detail
-
available
public int available() throws java.io.IOExceptionReturns 0 once the end of the stream (EOF) has been reached. Otherwise returns 1.- Overrides:
availablein classjava.io.FilterInputStream- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOExceptionCloses the input stream- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classjava.io.FilterInputStream- Throws:
java.io.IOException
-
fill
protected void fill() throws java.io.IOExceptionFills the buffer with more data to decompress.- Throws:
java.io.IOException
-
read
public int read() throws java.io.IOExceptionReads one byte of decompressed data. The byte is in the lower 8 bits of the int.- Overrides:
readin classjava.io.FilterInputStream- Throws:
java.io.IOException
-
read
public int read(byte[] b, int off, int len) throws java.io.IOExceptionDecompresses data into the byte array- Overrides:
readin classjava.io.FilterInputStream- 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:
java.io.IOException
-
skip
public long skip(long n) throws java.io.IOExceptionSkip specified number of bytes of uncompressed data- Overrides:
skipin classjava.io.FilterInputStream- Parameters:
n- number of bytes to skip- Throws:
java.io.IOException
-
-