Package com.google.protobuf
Class BinaryReader
- java.lang.Object
-
- com.google.protobuf.BinaryReader
-
- All Implemented Interfaces:
Reader
- Direct Known Subclasses:
BinaryReader.SafeHeapReader
@CheckReturnValue @ExperimentalApi abstract class BinaryReader extends java.lang.Object implements Reader
AReaderthat reads from a buffer containing a message serialized with the binary protocol.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classBinaryReader.SafeHeapReaderABinaryReaderimplementation that operates on a heapByteBuffer.
-
Field Summary
Fields Modifier and Type Field Description private static intFIXED32_MULTIPLE_MASKprivate static intFIXED64_MULTIPLE_MASK-
Fields inherited from interface com.google.protobuf.Reader
READ_DONE, TAG_UNKNOWN
-
-
Constructor Summary
Constructors Modifier Constructor Description privateBinaryReader()Only allow subclassing for inner classes.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract intgetTotalBytesRead()Returns the total number of bytes read so far from the input buffer.static BinaryReadernewInstance(java.nio.ByteBuffer buffer, boolean bufferIsImmutable)Creates a new reader using the givenbufferas input.booleanshouldDiscardUnknownFields()-
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 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
-
-