Package com.google.protobuf
Class BinaryReader
java.lang.Object
com.google.protobuf.BinaryReader
- All Implemented Interfaces:
Reader
- Direct Known Subclasses:
BinaryReader.SafeHeapReader
A
Reader
that reads from a buffer containing a message serialized with the binary
protocol.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final class
ABinaryReader
implementation that operates on a heapByteBuffer
. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final int
private static final int
Fields inherited from interface com.google.protobuf.Reader
READ_DONE, TAG_UNKNOWN
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract int
Returns the total number of bytes read so far from the input buffer.static BinaryReader
newInstance
(ByteBuffer buffer, boolean bufferIsImmutable) Creates a new reader using the givenbuffer
as input.boolean
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 Details
-
FIXED32_MULTIPLE_MASK
private static final int FIXED32_MULTIPLE_MASK- See Also:
-
FIXED64_MULTIPLE_MASK
private static final int FIXED64_MULTIPLE_MASK- See Also:
-
-
Constructor Details
-
BinaryReader
private BinaryReader()Only allow subclassing for inner classes.
-
-
Method Details
-
newInstance
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
-