Modifier and Type | Field and Description |
---|---|
private java.util.zip.CRC32 |
crc
Checksum used to check both the GZIP header and decompressed body.
|
private static byte |
FCOMMENT |
private static byte |
FEXTRA |
private static byte |
FHCRC |
private static byte |
FNAME |
private java.util.zip.Inflater |
inflater
The inflater used to decompress the deflated body.
|
private InflaterSource |
inflaterSource
The inflater source takes care of moving data between compressed source and
decompressed sink buffers.
|
private int |
section
The current section.
|
private static byte |
SECTION_BODY |
private static byte |
SECTION_DONE |
private static byte |
SECTION_HEADER |
private static byte |
SECTION_TRAILER |
private BufferedSource |
source
Our source should yield a GZIP header (which we consume directly), followed
by deflated bytes (which we consume via an InflaterSource), followed by a
GZIP trailer (which we also consume directly).
|
Constructor and Description |
---|
GzipSource(Source source) |
Modifier and Type | Method and Description |
---|---|
private void |
checkEqual(java.lang.String name,
int expected,
int actual) |
void |
close()
Closes this source and releases the resources held by this source.
|
private void |
consumeHeader() |
private void |
consumeTrailer() |
long |
read(Buffer sink,
long byteCount)
Removes at least 1, and up to
byteCount bytes from this and appends
them to sink . |
Timeout |
timeout()
Returns the timeout for this source.
|
private void |
updateCrc(Buffer buffer,
long offset,
long byteCount)
Updates the CRC with the given bytes.
|
private static final byte FHCRC
private static final byte FEXTRA
private static final byte FNAME
private static final byte FCOMMENT
private static final byte SECTION_HEADER
private static final byte SECTION_BODY
private static final byte SECTION_TRAILER
private static final byte SECTION_DONE
private int section
private final BufferedSource source
private final java.util.zip.Inflater inflater
private final InflaterSource inflaterSource
private final java.util.zip.CRC32 crc
public GzipSource(Source source)
public long read(Buffer sink, long byteCount) throws java.io.IOException
Source
byteCount
bytes from this and appends
them to sink
. Returns the number of bytes read, or -1 if this
source is exhausted.private void consumeHeader() throws java.io.IOException
java.io.IOException
private void consumeTrailer() throws java.io.IOException
java.io.IOException
public Timeout timeout()
Source
public void close() throws java.io.IOException
Source
private void updateCrc(Buffer buffer, long offset, long byteCount)
private void checkEqual(java.lang.String name, int expected, int actual) throws java.io.IOException
java.io.IOException