org.apache.commons.compress.compressors.gzip
Class GzipCompressorInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by org.apache.commons.compress.compressors.CompressorInputStream
          extended by org.apache.commons.compress.compressors.gzip.GzipCompressorInputStream
All Implemented Interfaces:
java.io.Closeable

public class GzipCompressorInputStream
extends CompressorInputStream

Implements the "gz" compression format as an input stream. This classes wraps the standard java classes for working with gz.


Field Summary
private  java.util.zip.GZIPInputStream in
           
 
Constructor Summary
GzipCompressorInputStream(java.io.InputStream inputStream)
          Constructs a new GZip compressed input stream by the referenced InputStream.
 
Method Summary
static boolean matches(byte[] signature, int length)
          Checks if the signature matches what is expected for a gzip file.
 int read()
          
 int read(byte[] b)
          
 int read(byte[] b, int from, int length)
          
 
Methods inherited from class org.apache.commons.compress.compressors.CompressorInputStream
count, count, getBytesRead, getCount
 
Methods inherited from class java.io.InputStream
available, close, mark, markSupported, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

in

private final java.util.zip.GZIPInputStream in
Constructor Detail

GzipCompressorInputStream

public GzipCompressorInputStream(java.io.InputStream inputStream)
                          throws java.io.IOException
Constructs a new GZip compressed input stream by the referenced InputStream.

Parameters:
inputStream - the InputStream from which this object should be created of
Throws:
java.io.IOException - if the stream could not be created
Method Detail

read

public int read()
         throws java.io.IOException

Specified by:
read in class java.io.InputStream
Throws:
java.io.IOException

read

public int read(byte[] b)
         throws java.io.IOException

Overrides:
read in class java.io.InputStream
Throws:
java.io.IOException
Since:
Apache Commons Compress 1.1

read

public int read(byte[] b,
                int from,
                int length)
         throws java.io.IOException

Overrides:
read in class java.io.InputStream
Throws:
java.io.IOException
Since:
Apache Commons Compress 1.1

matches

public static boolean matches(byte[] signature,
                              int length)
Checks if the signature matches what is expected for a gzip file.

Parameters:
signature - the bytes to check
length - the number of bytes to check
Returns:
true, if this stream is a gzipped compressed stream, false otherwise
Since:
Apache Commons Compress 1.1