Package com.google.protobuf
Class BinaryReader
- java.lang.Object
-
- com.google.protobuf.BinaryReader
-
- All Implemented Interfaces:
Reader
- Direct Known Subclasses:
BinaryReader.SafeHeapReader
@ExperimentalApi abstract class BinaryReader extends java.lang.Object implements Reader
AReader
that reads from a buffer containing a message serialized with the binary protocol.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
BinaryReader.SafeHeapReader
ABinaryReader
implementation that operates on a heapByteBuffer
.
-
Field Summary
Fields Modifier and Type Field Description private static int
FIXED32_MULTIPLE_MASK
private static int
FIXED64_MULTIPLE_MASK
-
Fields inherited from interface com.google.protobuf.Reader
READ_DONE, TAG_UNKNOWN
-
-
Constructor Summary
Constructors Modifier Constructor Description private
BinaryReader()
Only allow subclassing for inner classes.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract int
getTotalBytesRead()
Returns the total number of bytes read so far from the input buffer.static BinaryReader
newInstance(java.nio.ByteBuffer buffer, boolean bufferIsImmutable)
Creates a new reader using the givenbuffer
as input.boolean
shouldDiscardUnknownFields()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.google.protobuf.Reader
getFieldNumber, getTag, mergeGroupField, mergeMessageField, readBool, readBoolList, readBytes, readBytesList, readDouble, readDoubleList, readEnum, readEnumList, readFixed32, readFixed32List, readFixed64, readFixed64List, readFloat, readFloatList, readGroup, readGroupBySchemaWithCheck, readGroupList, readGroupList, readInt32, readInt32List, readInt64, readInt64List, readMap, readMessage, readMessageBySchemaWithCheck, readMessageList, readMessageList, readSFixed32, readSFixed32List, readSFixed64, readSFixed64List, readSInt32, readSInt32List, readSInt64, readSInt64List, readString, readStringList, readStringListRequireUtf8, readStringRequireUtf8, readUInt32, readUInt32List, readUInt64, readUInt64List, skipField
-
-
-
-
Field Detail
-
FIXED32_MULTIPLE_MASK
private static final int FIXED32_MULTIPLE_MASK
- See Also:
- Constant Field Values
-
FIXED64_MULTIPLE_MASK
private static final int FIXED64_MULTIPLE_MASK
- See Also:
- Constant Field Values
-
-
Method Detail
-
newInstance
public static BinaryReader newInstance(java.nio.ByteBuffer buffer, boolean bufferIsImmutable)
Creates a new reader using the givenbuffer
as input.- Parameters:
buffer
- the input buffer. The buffer (including position, limit, etc.) will not be modified. To increment the buffer position after the read completes, use the value returned bygetTotalBytesRead()
.bufferIsImmutable
- iftrue
the reader assumes that the content ofbuffer
will never change and any allocatedByteString
instances will by directly wrap slices ofbuffer
.- Returns:
- the reader
-
getTotalBytesRead
public abstract int getTotalBytesRead()
Returns the total number of bytes read so far from the input buffer.
-
shouldDiscardUnknownFields
public boolean shouldDiscardUnknownFields()
- Specified by:
shouldDiscardUnknownFields
in interfaceReader
-
-