| java.lang.Object org.archive.io.GzipHeader
GzipHeader | public class GzipHeader (Code) | | Read in the GZIP header.
See RFC1952 for specification on what the header looks like.
Assumption is that stream is cued-up with the gzip header as the
next thing to be read.
Of Java
and unsigned bytes. That is, its always a signed int in
java no matter what the qualifier whether byte, char, etc.
Add accessors for optional filename, comment and MTIME.
author: stack |
Field Summary | |
final public static int | MINIMAL_GZIP_HEADER_LENGTH Length of minimal GZIP header. | protected int | flg The GZIP header FLG byte. | protected int | length Total length of the gzip header. |
MINIMAL_GZIP_HEADER_LENGTH | final public static int MINIMAL_GZIP_HEADER_LENGTH(Code) | | Length of minimal GZIP header.
See RFC1952 for explaination of value of 10.
|
flg | protected int flg(Code) | | The GZIP header FLG byte.
|
length | protected int length(Code) | | Total length of the gzip header.
|
GzipHeader | public GzipHeader()(Code) | | Shutdown constructor.
Must pass an input stream.
|
GzipHeader | public GzipHeader(InputStream in) throws IOException(Code) | | Constructor.
This constructor advances the stream past any gzip header found.
Parameters: in - InputStream to read from. throws: IOException - |
getFextra | public byte[] getFextra()(Code) | | Returns the fextra. |
getFlg | public int getFlg()(Code) | | Returns the flg. |
getLength | public int getLength()(Code) | | Returns the length. |
getMtime | public int getMtime()(Code) | | Returns the mtime. |
getOs | public int getOs()(Code) | | Returns the os. |
getXfl | public int getXfl()(Code) | | Returns the xfl. |
readByte | protected int readByte(InputStream in) throws IOException(Code) | | Read a byte.
We do not expect to get a -1 reading. If we do, we throw exception.
Update the crc as we go.
Parameters: in - InputStream to read. Byte read. throws: IOException - |
readByte | protected int readByte(InputStream in, CRC32 crc) throws IOException(Code) | | Read a byte.
We do not expect to get a -1 reading. If we do, we throw exception.
Update the crc as we go.
Parameters: in - InputStream to read. Parameters: crc - CRC to update. Byte read. throws: IOException - |
readByte | protected int readByte(InputStream in, CRC32 crc, byte[] buffer, int offset, int length) throws IOException(Code) | | Read a byte.
We do not expect to get a -1 reading. If we do, we throw exception.
Update the crc as we go.
Parameters: in - InputStream to read. Parameters: crc - CRC to update. Parameters: buffer - Buffer to read into. Parameters: offset - Offset to start filling buffer at. Parameters: length - How much to read. Bytes read. throws: IOException - |
readHeader | public void readHeader(InputStream in) throws IOException(Code) | | Read in gzip header.
Advances the stream past the gzip header.
Parameters: in - InputStream. throws: IOException - Throws if does not start with GZIP Header. |
testGzipMagic | public boolean testGzipMagic(InputStream in) throws IOException(Code) | | Test gzip magic is next in the stream.
Reads two bytes. Caller needs to manage resetting stream.
Parameters: in - InputStream to read. true if found gzip magic. False otherwiseor an IOException (including EOFException). throws: IOException - |
testGzipMagic | public boolean testGzipMagic(InputStream in, CRC32 crc) throws IOException(Code) | | Test gzip magic is next in the stream.
Reads two bytes. Caller needs to manage resetting stream.
Parameters: in - InputStream to read. Parameters: crc - CRC to update. true if found gzip magic. False otherwiseor an IOException (including EOFException). throws: IOException - |
|
|