net.sf.zipme
Class InflaterInputStream

java.lang.Object
  extended byjava.io.InputStream
      extended bynet.sf.zipme.InflaterInputStream
Direct Known Subclasses:
GZIPInputStream, ZipInputStream

public class InflaterInputStream
extends java.io.InputStream

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  java.io.InputStream in
          This is the subordinate InputStream to which method calls are redirected
protected  Inflater inf
          Decompressor for this filter
protected  int len
          Size of buffer
 
Constructor Summary
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
 int available()
          Returns 0 once the end of the stream (EOF) has been reached.
 void close()
          Closes the input stream
protected  void fill()
          Fills the buffer with more data to decompress.
 void mark(int readLimit)
           
 boolean markSupported()
           
 int read()
          Reads one byte of decompressed data.
 int read(byte[] buf)
          Calls the read(byte[], int, int) overloaded method.
 int read(byte[] b, int off, int len)
          Decompresses data into the byte array
 void reset()
           
 long skip(long n)
          Skip specified number of bytes of uncompressed data
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

in

protected java.io.InputStream in
This is the subordinate InputStream to which method calls are redirected


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

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 from
inf - 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 from
inf - the decompressor used to decompress data read from in
size - size of the buffer to use
Method Detail

available

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

Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Closes the input stream

Throws:
java.io.IOException

fill

protected void fill()
             throws java.io.IOException
Fills the buffer with more data to decompress.

Throws:
java.io.IOException

read

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

Throws:
java.io.IOException

read

public int read(byte[] buf)
         throws java.io.IOException
Calls the read(byte[], int, int) overloaded method. Note that this method does not redirect its call directly to a corresponding method in in. This allows subclasses to override only the three argument version of read.

Parameters:
buf - The buffer to read bytes into
Returns:
The value retured from in.read(byte[], int, int)
Throws:
java.io.IOException - If an error occurs

read

public int read(byte[] b,
                int off,
                int len)
         throws java.io.IOException
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
Throws:
java.io.IOException

skip

public long skip(long n)
          throws java.io.IOException
Skip specified number of bytes of uncompressed data

Parameters:
n - number of bytes to skip
Throws:
java.io.IOException

markSupported

public boolean markSupported()

mark

public void mark(int readLimit)

reset

public void reset()
           throws java.io.IOException
Throws:
java.io.IOException