org.bolet.jgz
Class GZipInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by org.bolet.jgz.GZipInputStream
All Implemented Interfaces:
java.io.Closeable

public class GZipInputStream
extends java.io.InputStream

This class decompresses a data stream compressed in the gzip format, as documented in RFC 1952. It is somewhat similar to the standard java.util.zip.GZIPInputStream class.

This stream is blocking: when asked to read a given amount of uncompressed bytes, it will return that number of bytes, possibly invoking many times the underlying stream. A short count is possible only if the end of the underlying stream was reached. Note that end-of-stream may occur only between gzip "members"; unexpected end-of-stream is a format error which is reported as such.

gzip streams may contain some meta-information such as a file name or producer OS; these are not returned by this class. To access meta-information, use the more generic GZipDecoder class.

It is highly recommended that the provided source input stream is buffered. The inflater engine will read it byte by byte most of the time.


Constructor Summary
GZipInputStream(java.io.InputStream sub)
          Create the stream over the provided underlying stream.
 
Method Summary
 void close()
          The implementation for this method closes the underlying input stream.
 int read()
           
 int read(byte[] buf)
           
 int read(byte[] buf, int off, int len)
           
 
Methods inherited from class java.io.InputStream
available, mark, markSupported, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GZipInputStream

public GZipInputStream(java.io.InputStream sub)
Create the stream over the provided underlying stream.

Parameters:
sub - the underlying stream
Method Detail

close

public void close()
           throws java.io.IOException
The implementation for this method closes the underlying input stream.

Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.InputStream
Throws:
java.io.IOException
See Also:
InputStream

read

public int read()
         throws java.io.IOException
Specified by:
read in class java.io.InputStream
Throws:
java.io.IOException
See Also:
InputStream

read

public int read(byte[] buf)
         throws java.io.IOException
Overrides:
read in class java.io.InputStream
Throws:
java.io.IOException
See Also:
InputStream

read

public int read(byte[] buf,
                int off,
                int len)
         throws java.io.IOException
Overrides:
read in class java.io.InputStream
Throws:
java.io.IOException
See Also:
InputStream