readTag() and
readInt32()) and methods that read low-level values (e.g.
readRawVarint32() and readRawBytes). If you are reading
encoded protocol messages, you should use the former methods, but if you are
reading some other format of your own design, use the latter.
| Modifier and Type | Field and Description |
|---|---|
| private final byte[] | |
| private int | |
| private int | |
| private int | |
| private int | |
| private int | currentLimit
The absolute position of the end of the current message. |
| private static final int | |
| private static final int | |
| private int | |
| private int | recursionDepth
See setRecursionLimit() |
| private int | |
| private int | sizeLimit
See setSizeLimit() |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public void | checkLastTagWas(final int value)
Verifies that the last call to readTag() returned the given tag value. |
| public static int | Returns: A signed 32-bit integer.An unsigned 32-bit integer, stored in a signed int because
Java has no explicit unsigned support. n)Decode a ZigZag-encoded 32-bit value. |
| public static long | Returns: A signed 64-bit integer.An unsigned 64-bit integer, stored in a signed int because
Java has no explicit unsigned support. n)Decode a ZigZag-encoded 64-bit value. |
| public int | |
| public byte[] | getData(int
the position (relative to the buffer start position) to start at. offset, int the number of bytes to retrieve. length)Retrieves a subset of data in the buffer. |
| public int | |
| public boolean | |
| public static CodedInputByteBufferNano | |
| public static CodedInputByteBufferNano | newInstance(final byte[] buf, final int off, final int len)
Create a new CodedInputStream wrapping the given byte array slice. |
| public void | popLimit(final int
The old limit, as returned by oldLimit)pushLimit.Discards the current limit, returning to the previous limit. |
| public int | |
| public boolean | |
| public byte[] | |
| public double | |
| public int | |
| public int | |
| public long | |
| public float | |
| public void | |
| public int | |
| public long | |
| public void | |
| pack-priv Object | |
| public byte | |
| public byte[] | |
| public int | |
| public long | |
| public int | |
| public long | |
| public int | |
| public long | |
| public int | |
| public long | |
| public String | |
| public int | |
| public int | |
| public long | |
| private void | |
| public void | |
| public void | |
| public int | |
| public int | |
| public boolean | Returns: false if the tag is an endgroup tag, in which case
nothing is skipped. Otherwise, returns true.Reads and discards a single field, given its tag value. |
| public void | |
| public void |
| buffer | back to summary |
|---|---|
| private final byte[] buffer | |
| bufferPos | back to summary |
|---|---|
| private int bufferPos | |
| bufferSize | back to summary |
|---|---|
| private int bufferSize | |
| bufferSizeAfterLimit | back to summary |
|---|---|
| private int bufferSizeAfterLimit | |
| bufferStart | back to summary |
|---|---|
| private int bufferStart | |
| currentLimit | back to summary |
|---|---|
| private int currentLimit The absolute position of the end of the current message. | |
| DEFAULT_RECURSION_LIMIT | back to summary |
|---|---|
| private static final int DEFAULT_RECURSION_LIMIT | |
| DEFAULT_SIZE_LIMIT | back to summary |
|---|---|
| private static final int DEFAULT_SIZE_LIMIT | |
| lastTag | back to summary |
|---|---|
| private int lastTag | |
| recursionDepth | back to summary |
|---|---|
| private int recursionDepth See setRecursionLimit() | |
| recursionLimit | back to summary |
|---|---|
| private int recursionLimit | |
| sizeLimit | back to summary |
|---|---|
| private int sizeLimit See setSizeLimit() | |
| CodedInputByteBufferNano | back to summary |
|---|---|
| private CodedInputByteBufferNano(final byte[] buffer, final int off, final int len) | |
| checkLastTagWas | back to summary |
|---|---|
| public void checkLastTagWas(final int value) throws InvalidProtocolBufferNanoException Verifies that the last call to readTag() returned the given tag value. This is used to verify that a nested group ended with the correct end tag.
| |
| decodeZigZag32 | back to summary |
|---|---|
| public static int decodeZigZag32(final int n) Decode a ZigZag-encoded 32-bit value. ZigZag encodes signed integers into values that can be efficiently encoded with varint. (Otherwise, negative values must be sign-extended to 64 bits to be varint encoded, thus always taking 10 bytes on the wire.)
| |
| decodeZigZag64 | back to summary |
|---|---|
| public static long decodeZigZag64(final long n) Decode a ZigZag-encoded 64-bit value. ZigZag encodes signed integers into values that can be efficiently encoded with varint. (Otherwise, negative values must be sign-extended to 64 bits to be varint encoded, thus always taking 10 bytes on the wire.)
| |
| getBytesUntilLimit | back to summary |
|---|---|
| public int getBytesUntilLimit() Returns the number of bytes to be read before the current limit. If no limit is set, returns -1. | |
| getData | back to summary |
|---|---|
| public byte[] getData(int offset, int length) Retrieves a subset of data in the buffer. The returned array is not backed by the original buffer array.
| |
| getPosition | back to summary |
|---|---|
| public int getPosition() Get current position in buffer relative to beginning offset. | |
| isAtEnd | back to summary |
|---|---|
| public boolean isAtEnd() Returns true if the stream has reached the end of the input. This is the
case if either the end of the underlying input source has been reached or
if the stream has reached a limit created using | |
| newInstance | back to summary |
|---|---|
| public static CodedInputByteBufferNano newInstance(final byte[] buf) Create a new CodedInputStream wrapping the given byte array. | |
| newInstance | back to summary |
|---|---|
| public static CodedInputByteBufferNano newInstance(final byte[] buf, final int off, final int len) Create a new CodedInputStream wrapping the given byte array slice. | |
| popLimit | back to summary |
|---|---|
| public void popLimit(final int oldLimit) Discards the current limit, returning to the previous limit.
| |
| pushLimit | back to summary |
|---|---|
| public int pushLimit(int byteLimit) throws InvalidProtocolBufferNanoException Sets
| |
| readBool | back to summary |
|---|---|
| public boolean readBool() throws IOException Read a | |
| readBytes | back to summary |
|---|---|
| public byte[] readBytes() throws IOException Read a | |
| readDouble | back to summary |
|---|---|
| public double readDouble() throws IOException Read a | |
| readEnum | back to summary |
|---|---|
| public int readEnum() throws IOException Read an enum field value from the stream. Caller is responsible for converting the numeric value to an actual enum. | |
| readFixed32 | back to summary |
|---|---|
| public int readFixed32() throws IOException Read a | |
| readFixed64 | back to summary |
|---|---|
| public long readFixed64() throws IOException Read a | |
| readFloat | back to summary |
|---|---|
| public float readFloat() throws IOException Read a | |
| readGroup | back to summary |
|---|---|
| public void readGroup(final MessageNano msg, final int fieldNumber) throws IOException Read a | |
| readInt32 | back to summary |
|---|---|
| public int readInt32() throws IOException Read an | |
| readInt64 | back to summary |
|---|---|
| public long readInt64() throws IOException Read an | |
| readMessage | back to summary |
|---|---|
| public void readMessage(final MessageNano msg) throws IOException | |
| readPrimitiveField | back to summary |
|---|---|
| pack-priv Object readPrimitiveField(int type) throws IOException | |
| readRawByte | back to summary |
|---|---|
| public byte readRawByte() throws IOException Read one byte from the input.
| |
| readRawBytes | back to summary |
|---|---|
| public byte[] readRawBytes(final int size) throws IOException Read a fixed size of bytes from the input.
| |
| readRawLittleEndian32 | back to summary |
|---|---|
| public int readRawLittleEndian32() throws IOException Read a 32-bit little-endian integer from the stream. | |
| readRawLittleEndian64 | back to summary |
|---|---|
| public long readRawLittleEndian64() throws IOException Read a 64-bit little-endian integer from the stream. | |
| readRawVarint32 | back to summary |
|---|---|
| public int readRawVarint32() throws IOException Read a raw Varint from the stream. If larger than 32 bits, discard the upper bits. | |
| readRawVarint64 | back to summary |
|---|---|
| public long readRawVarint64() throws IOException Read a raw Varint from the stream. | |
| readSFixed32 | back to summary |
|---|---|
| public int readSFixed32() throws IOException Read an | |
| readSFixed64 | back to summary |
|---|---|
| public long readSFixed64() throws IOException Read an | |
| readSInt32 | back to summary |
|---|---|
| public int readSInt32() throws IOException Read an | |
| readSInt64 | back to summary |
|---|---|
| public long readSInt64() throws IOException Read an | |
| readString | back to summary |
|---|---|
| public String readString() throws IOException Read a | |
| readTag | back to summary |
|---|---|
| public int readTag() throws IOException Attempt to read a field tag, returning zero if we have reached EOF. Protocol message parsers use this to read tags, since a protocol message may legally end wherever a tag occurs, and zero is not a valid tag number. | |
| readUInt32 | back to summary |
|---|---|
| public int readUInt32() throws IOException Read a | |
| readUInt64 | back to summary |
|---|---|
| public long readUInt64() throws IOException Read a | |
| recomputeBufferSizeAfterLimit | back to summary |
|---|---|
| private void recomputeBufferSizeAfterLimit() | |
| resetSizeCounter | back to summary |
|---|---|
| public void resetSizeCounter() Resets the current size counter to zero (see | |
| rewindToPosition | back to summary |
|---|---|
| public void rewindToPosition(int position) Rewind to previous position. Cannot go forward. | |
| setRecursionLimit | back to summary |
|---|---|
| public int setRecursionLimit(final int limit) Set the maximum message recursion depth. In order to prevent malicious
messages from causing stack overflows,
| |
| setSizeLimit | back to summary |
|---|---|
| public int setSizeLimit(final int limit) Set the maximum message size. In order to prevent malicious
messages from exhausting memory or causing integer overflows,
If you want to read several messages from a single CodedInputStream, you
could call
| |
| skipField | back to summary |
|---|---|
| public boolean skipField(final int tag) throws IOException Reads and discards a single field, given its tag value.
| |
| skipMessage | back to summary |
|---|---|
| public void skipMessage() throws IOException Reads and discards an entire message. This will read either until EOF or until an endgroup tag, whichever comes first. | |
| skipRawBytes | back to summary |
|---|---|
| public void skipRawBytes(final int size) throws IOException Reads and discards
| |