Package io.grpc.internal
Class GzipInflatingBuffer.GzipMetadataReader
- java.lang.Object
-
- io.grpc.internal.GzipInflatingBuffer.GzipMetadataReader
-
- Enclosing class:
- GzipInflatingBuffer
private class GzipInflatingBuffer.GzipMetadataReader extends java.lang.Object
Reads gzip header and trailer bytes from the inflater's buffer (if bytes beyond the inflate block were given to the inflater) and then fromgzippedData
, and handles updating the CRC and the count of gzipped bytes consumed.
-
-
Constructor Summary
Constructors Modifier Constructor Description private
GzipMetadataReader()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private int
readableBytes()
private boolean
readBytesUntilZero()
Skip over a zero-terminated byte sequence.private int
readUnsignedByte()
Returns the next unsigned byte, adding it the CRC and incrementingbytesConsumed
.private long
readUnsignedInt()
Reads unsigned integer in Little-Endian byte order.private int
readUnsignedShort()
Reads unsigned short in Little-Endian byte order.private void
skipBytes(int length)
Skipslength
bytes, adding them to the CRC and addinglength
tobytesConsumed
.
-
-
-
Method Detail
-
readUnsignedByte
private int readUnsignedByte()
Returns the next unsigned byte, adding it the CRC and incrementingbytesConsumed
.It is the responsibility of the caller to verify and reset the CRC as needed, as well as caching the current CRC value when necessary before invoking this method.
-
skipBytes
private void skipBytes(int length)
Skipslength
bytes, adding them to the CRC and addinglength
tobytesConsumed
.It is the responsibility of the caller to verify and reset the CRC as needed, as well as caching the current CRC value when necessary before invoking this method.
-
readableBytes
private int readableBytes()
-
readBytesUntilZero
private boolean readBytesUntilZero()
Skip over a zero-terminated byte sequence. Returns true when the zero byte is read.
-
readUnsignedShort
private int readUnsignedShort()
Reads unsigned short in Little-Endian byte order.
-
readUnsignedInt
private long readUnsignedInt()
Reads unsigned integer in Little-Endian byte order.
-
-