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 classABinaryReaderimplementation that operates on a heapByteBuffer. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intprivate static final intFields inherited from interface com.google.protobuf.Reader
READ_DONE, TAG_UNKNOWN -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract intReturns the total number of bytes read so far from the input buffer.static BinaryReadernewInstance(ByteBuffer buffer, boolean bufferIsImmutable) Creates a new reader using the givenbufferas input.booleanMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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 givenbufferas 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- iftruethe reader assumes that the content ofbufferwill never change and any allocatedByteStringinstances 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:
shouldDiscardUnknownFieldsin interfaceReader
-