Package net.sf.jazzlib
Class GZIPInputStream
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
net.sf.jazzlib.InflaterInputStream
net.sf.jazzlib.GZIPInputStream
- All Implemented Interfaces:
Closeable,AutoCloseable
This filter stream is used to decompress a "GZIP" format stream. The "GZIP"
format is described in RFC 1952.
- Since:
- JDK 1.1
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected CRC32The CRC-32 checksum value for uncompressed data.protected booleanIndicates whether or not the end of the stream has been reached.(package private) static final intThe mask for bit 4 of the flag byte.(package private) static final intThe mask for bit 2 of the flag byte.(package private) static final intThe mask for bit 1 of the flag byte.(package private) static final intThe mask for bit 3 of the flag byte.(package private) static final intThe mask for bit 0 of the flag byte.static final intThe magic number found at the start of a GZIP stream.private booleanIndicates whether or not the GZIP header has been read in.Fields inherited from class net.sf.jazzlib.InflaterInputStream
buf, inf, lenFields inherited from class java.io.FilterInputStream
in -
Constructor Summary
ConstructorsConstructorDescriptionCreates a GZIPInputStream with the default buffer size.GZIPInputStream(InputStream in, int size) Creates a GZIPInputStream with the specified buffer size. -
Method Summary
Methods inherited from class net.sf.jazzlib.InflaterInputStream
available, fill, read, skipMethods inherited from class java.io.FilterInputStream
mark, markSupported, read, resetMethods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Field Details
-
GZIP_MAGIC
public static final int GZIP_MAGICThe magic number found at the start of a GZIP stream.- See Also:
-
FTEXT
static final int FTEXTThe mask for bit 0 of the flag byte.- See Also:
-
FHCRC
static final int FHCRCThe mask for bit 1 of the flag byte.- See Also:
-
FEXTRA
static final int FEXTRAThe mask for bit 2 of the flag byte.- See Also:
-
FNAME
static final int FNAMEThe mask for bit 3 of the flag byte.- See Also:
-
FCOMMENT
static final int FCOMMENTThe mask for bit 4 of the flag byte.- See Also:
-
crc
The CRC-32 checksum value for uncompressed data. -
eos
protected boolean eosIndicates whether or not the end of the stream has been reached. -
readGZIPHeader
private boolean readGZIPHeaderIndicates whether or not the GZIP header has been read in.
-
-
Constructor Details
-
GZIPInputStream
Creates a GZIPInputStream with the default buffer size.- Parameters:
in- The stream to read compressed data from (in GZIP format).- Throws:
IOException- if an error occurs during an I/O operation.
-
GZIPInputStream
Creates a GZIPInputStream with the specified buffer size.- Parameters:
in- The stream to read compressed data from (in GZIP format).size- The size of the buffer to use.- Throws:
IOException- if an error occurs during an I/O operation.IllegalArgumentException- ifsizeis less than or equal to 0.
-
-
Method Details
-
close
Closes the input stream.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInflaterInputStream- Throws:
IOException- if an error occurs during an I/O operation.
-
read
Reads in GZIP-compressed data and stores it in uncompressed form into an array of bytes. The method will block until either enough input data becomes available or the compressed stream reaches its end.- Overrides:
readin classInflaterInputStream- Parameters:
buf- the buffer into which the uncompressed data will be stored.offset- the offset indicating where inbufthe uncompressed data should be placed.len- the number of uncompressed bytes to be read.- Throws:
IOException
-
readHeader
Reads in the GZIP header.- Throws:
IOException
-