Package com.google.protobuf
Class ByteString.LeafByteString
java.lang.Object
com.google.protobuf.ByteString
com.google.protobuf.ByteString.LeafByteString
- All Implemented Interfaces:
Serializable,Iterable<Byte>
- Direct Known Subclasses:
ByteString.LiteralByteString,NioByteString
- Enclosing class:
- ByteString
Base class for leaf
ByteStrings (i.e. non-ropes).-
Nested Class Summary
Nested classes/interfaces inherited from class com.google.protobuf.ByteString
ByteString.AbstractByteIterator, ByteString.ByteIterator, ByteString.CodedBuilder, ByteString.LeafByteString, ByteString.Output -
Field Summary
FieldsFields inherited from class com.google.protobuf.ByteString
CONCATENATE_BY_COPY_SIZE, EMPTY, MAX_READ_FROM_CHUNK_SIZE, MIN_READ_FROM_CHUNK_SIZE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) abstract booleanequalsRange(ByteString other, int offset, int length) Check equality of the substring of given length of this object starting at zero with anotherByteStringsubstring starting at offset.protected final intReturn the depth of the tree representing thisByteString, if any, whose root is this node.protected final booleanReturntrueif this ByteString is literal (a leaf node) or a flat-enough tree in the sense ofRopeByteString.(package private) voidwriteToReverse(ByteOutput byteOutput) This method behaves exactly the same asByteString.writeTo(ByteOutput)unless theByteStringis a rope.Methods inherited from class com.google.protobuf.ByteString
asReadOnlyByteBuffer, asReadOnlyByteBufferList, byteAt, checkIndex, checkRange, concat, copyFrom, copyFrom, copyFrom, copyFrom, copyFrom, copyFrom, copyFrom, copyFromUtf8, copyTo, copyTo, copyTo, copyToInternal, empty, endsWith, equals, fromHex, hashCode, internalByteAt, isEmpty, isValidUtf8, iterator, newCodedBuilder, newCodedInput, newInput, newOutput, newOutput, partialHash, partialIsValidUtf8, peekCachedHashCode, readFrom, readFrom, readFrom, size, startsWith, substring, substring, toByteArray, toString, toString, toString, toStringInternal, toStringUtf8, unsignedLexicographicalComparator, wrap, wrap, wrap, writeTo, writeTo, writeTo, writeToInternalMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
-
Constructor Details
-
LeafByteString
LeafByteString()
-
-
Method Details
-
getTreeDepth
protected final int getTreeDepth()Description copied from class:ByteStringReturn the depth of the tree representing thisByteString, if any, whose root is this node. If this is a leaf node, return 0.- Specified by:
getTreeDepthin classByteString- Returns:
- tree depth or zero
-
isBalanced
protected final boolean isBalanced()Description copied from class:ByteStringReturntrueif this ByteString is literal (a leaf node) or a flat-enough tree in the sense ofRopeByteString.- Specified by:
isBalancedin classByteString- Returns:
- true if the tree is flat enough
-
writeToReverse
Description copied from class:ByteStringThis method behaves exactly the same asByteString.writeTo(ByteOutput)unless theByteStringis a rope. For ropes, the leaf nodes are written in reverse order to thebyteOutput.- Specified by:
writeToReversein classByteString- Parameters:
byteOutput- the output target to receive the bytes- Throws:
IOException- if an I/O error occurs- See Also:
-
UnsafeByteOperations#unsafeWriteToReverse(ByteString, ByteOutput)
-
equalsRange
Check equality of the substring of given length of this object starting at zero with anotherByteStringsubstring starting at offset.- Parameters:
other- what to compare a substring inoffset- offset into otherlength- number of bytes to compare- Returns:
- true for equality of substrings, else false.
-