Final

java.util.zip
Class GZIPInputStream

java.lang.Object
  extended byjava.io.InputStream
      extended byjava.io.FilterInputStream
          extended byjava.util.zip.InflaterInputStream
              extended byjava.util.zip.GZIPInputStream

public class GZIPInputStream
extends InflaterInputStream

The GZIPInputStream class is used to read data stored in the GZIP format.


Field Summary
protected  CRC32 crc
           
protected  boolean eos
           
static int GZIP_MAGIC
           
 
Fields inherited from class java.util.zip.InflaterInputStream
buf, inf, len
 
Fields inherited from class java.io.FilterInputStream
in
 
Constructor Summary
GZIPInputStream(InputStream is)
          Construct a GZIPInputStream to read from GZIP data from the underlying stream
GZIPInputStream(InputStream is, int size)
          Construct a GZIPInputStream to read from GZIP data from the underlying stream.
 
Method Summary
 void close()
          Closes this stream and any underlying streams.
 int read(byte[] buffer, int off, int nbytes)
          Reads and decompresses GZIP data from the underlying stream into buf.
 
Methods inherited from class java.util.zip.InflaterInputStream
available, fill, read, skip
 
Methods inherited from class java.io.FilterInputStream
mark, markSupported, read, reset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

crc

protected CRC32 crc

eos

protected boolean eos

GZIP_MAGIC

public static final int GZIP_MAGIC
See Also:
Constant Field Values
Constructor Detail

GZIPInputStream

public GZIPInputStream(InputStream is)
                throws IOException
Construct a GZIPInputStream to read from GZIP data from the underlying stream

Parameters:
is - InputStream to read data from

GZIPInputStream

public GZIPInputStream(InputStream is,
                       int size)
                throws IOException
Construct a GZIPInputStream to read from GZIP data from the underlying stream. Set the internal buffer size to size

Parameters:
is - InputStream to read data from
size - Internal read buffer size
Method Detail

read

public int read(byte[] buffer,
                int off,
                int nbytes)
         throws IOException
Reads and decompresses GZIP data from the underlying stream into buf.

Overrides:
read in class InflaterInputStream
Parameters:
buffer - Buffer to receive data
off - Offset in buffer to store data
nbytes - Number of bytes to read
Returns:
Number of uncompressed bytes read
Throws:
IOException - If an error occurs reading

close

public void close()
           throws IOException
Closes this stream and any underlying streams.

Overrides:
close in class InflaterInputStream
Throws:
IOException - If an error occurs closing the stream

Final

Licensed Materials - Property of IBM
(C) Copyright IBM Corp. 2006 All Rights Reserved.