public class GzipHeader extends Object
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.
| Modifier and Type | Field and Description |
|---|---|
protected int |
flg
The GZIP header FLG byte.
|
protected int |
length
Total length of the gzip header.
|
static int |
MINIMAL_GZIP_HEADER_LENGTH
Length of minimal GZIP header.
|
| Constructor and Description |
|---|
GzipHeader()
Shutdown constructor.
|
GzipHeader(InputStream in)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
byte[] |
getFextra() |
int |
getFlg() |
int |
getLength() |
int |
getMtime() |
int |
getOs() |
int |
getXfl() |
protected int |
readByte(InputStream in)
Read a byte.
|
protected int |
readByte(InputStream in,
CRC32 crc)
Read a byte.
|
protected int |
readByte(InputStream in,
CRC32 crc,
byte[] buffer,
int offset,
int length)
Read a byte.
|
void |
readHeader(InputStream in)
Read in gzip header.
|
boolean |
testGzipMagic(InputStream in)
Test gzip magic is next in the stream.
|
boolean |
testGzipMagic(InputStream in,
CRC32 crc)
Test gzip magic is next in the stream.
|
public static final int MINIMAL_GZIP_HEADER_LENGTH
protected int length
protected int flg
public GzipHeader()
public GzipHeader(InputStream in) throws IOException
in - InputStream to read from.IOExceptionpublic void readHeader(InputStream in) throws IOException
in - InputStream.IOException - Throws if does not start with GZIP Header.public boolean testGzipMagic(InputStream in) throws IOException
in - InputStream to read.IOExceptionpublic boolean testGzipMagic(InputStream in, CRC32 crc) throws IOException
in - InputStream to read.crc - CRC to update.IOExceptionprotected int readByte(InputStream in) throws IOException
in - InputStream to read.IOExceptionprotected int readByte(InputStream in, CRC32 crc) throws IOException
in - InputStream to read.crc - CRC to update.IOExceptionprotected int readByte(InputStream in, CRC32 crc, byte[] buffer, int offset, int length) throws IOException
in - InputStream to read.crc - CRC to update.buffer - Buffer to read into.offset - Offset to start filling buffer at.length - How much to read.IOExceptionpublic byte[] getFextra()
public int getFlg()
public int getOs()
public int getXfl()
public int getMtime()
public int getLength()
Copyright © 2015 The International Internet Preservation Consortium. All Rights Reserved.