Class OpenJDK7GZIPInputStream
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
org.archive.util.zip.OpenJDK7InflaterInputStream
org.archive.util.zip.OpenJDK7GZIPInputStream
- All Implemented Interfaces:
Closeable,AutoCloseable
- Direct Known Subclasses:
GZIPMembersInputStream,MultiMemberOpenJDKGZIPInputStream
This class implements a stream filter for reading compressed data in
the GZIP file format.
- Author:
- David Connelly
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected CRC32CRC-32 for uncompressed data.protected booleanIndicates end of input stream.protected static final intprotected static final intprotected static final intprotected static final intprotected static final intstatic final intGZIP header magic number.Fields inherited from class org.archive.util.zip.OpenJDK7InflaterInputStream
buf, inf, len, usesDefaultInflaterFields inherited from class java.io.FilterInputStream
in -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new input stream with a default buffer size.OpenJDK7GZIPInputStream(InputStream in, int size) Creates a new input stream with the specified buffer size. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes this input stream and releases any system resources associated with the stream.intread(byte[] buf, int off, int len) Reads uncompressed data into an array of bytes.protected intreadHeader(InputStream this_in) protected booleanprotected intreadUByte(InputStream in) protected longreadUInt(InputStream in) protected intprotected voidskipBytes(InputStream in, int n) Methods inherited from class org.archive.util.zip.OpenJDK7InflaterInputStream
available, fill, mark, markSupported, read, reset, skipMethods inherited from class java.io.FilterInputStream
read
-
Field Details
-
crc
CRC-32 for uncompressed data. -
eos
protected boolean eosIndicates end of input stream. -
GZIP_MAGIC
public static final int GZIP_MAGICGZIP header magic number.- See Also:
-
FTEXT
protected static final int FTEXT- See Also:
-
FHCRC
protected static final int FHCRC- See Also:
-
FEXTRA
protected static final int FEXTRA- See Also:
-
FNAME
protected static final int FNAME- See Also:
-
FCOMMENT
protected static final int FCOMMENT- See Also:
-
-
Constructor Details
-
OpenJDK7GZIPInputStream
Creates a new input stream with the specified buffer size.- Parameters:
in- the input streamsize- the input buffer size- Throws:
ZipException- if a GZIP format error has occurred or the compression method used is unsupportedIOException- if an I/O error has occurredIllegalArgumentException- if size is <= 0
-
OpenJDK7GZIPInputStream
Creates a new input stream with a default buffer size.- Parameters:
in- the input stream- Throws:
ZipException- if a GZIP format error has occurred or the compression method used is unsupportedIOException- if an I/O error has occurred
-
-
Method Details
-
read
Reads uncompressed data into an array of bytes. Iflenis not zero, the method will block until some input can be decompressed; otherwise, no bytes are read and0is returned.- Overrides:
readin classOpenJDK7InflaterInputStream- Parameters:
buf- the buffer into which the data is readoff- the start offset in the destination arrayblen- the maximum number of bytes read- Returns:
- the actual number of bytes read, or -1 if the end of the compressed input stream is reached
- Throws:
NullPointerException- Ifbufisnull.IndexOutOfBoundsException- Ifoffis negative,lenis negative, orlenis greater thanbuf.length - offZipException- if the compressed input data is corrupt.IOException- if an I/O error has occurred.
-
close
Closes this input stream and releases any system resources associated with the stream.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classOpenJDK7InflaterInputStream- Throws:
IOException- if an I/O error has occurred
-
readHeader
- Throws:
IOException
-
readTrailer
- Throws:
IOException
-
readUInt
- Throws:
IOException
-
readUShort
- Throws:
IOException
-
readUByte
- Throws:
IOException
-
skipBytes
- Throws:
IOException
-