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
,ByteString.NioByteString
- Enclosing class:
ByteString
Base class for leaf
ByteString
s (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 boolean
equalsRange
(ByteString other, int offset, int length) Check equality of the substring of given length of this object starting at zero with anotherByteString
substring starting at offset.protected final int
Return the depth of the tree representing thisByteString
, if any, whose root is this node.protected final boolean
Returntrue
if this ByteString is literal (a leaf node) or a flat-enough tree in the sense ofRopeByteString
.(package private) void
writeToReverse
(ByteOutput byteOutput) This method behaves exactly the same asByteString.writeTo(ByteOutput)
unless theByteString
is 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, nioByteString, partialHash, partialIsValidUtf8, peekCachedHashCode, readFrom, readFrom, readFrom, size, startsWith, substring, substring, toByteArray, toString, toString, toString, toStringInternal, toStringUtf8, unsignedLexicographicalComparator, wrap, wrap, wrap, writeTo, writeTo, writeTo, writeToInternal
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
-
Constructor Details
-
LeafByteString
private LeafByteString()
-
-
Method Details
-
getTreeDepth
protected final int getTreeDepth()Description copied from class:ByteString
Return the depth of the tree representing thisByteString
, if any, whose root is this node. If this is a leaf node, return 0.- Specified by:
getTreeDepth
in classByteString
- Returns:
- tree depth or zero
-
isBalanced
protected final boolean isBalanced()Description copied from class:ByteString
Returntrue
if this ByteString is literal (a leaf node) or a flat-enough tree in the sense ofRopeByteString
.- Specified by:
isBalanced
in classByteString
- Returns:
- true if the tree is flat enough
-
writeToReverse
Description copied from class:ByteString
This method behaves exactly the same asByteString.writeTo(ByteOutput)
unless theByteString
is a rope. For ropes, the leaf nodes are written in reverse order to thebyteOutput
.- Specified by:
writeToReverse
in classByteString
- Parameters:
byteOutput
- the output target to receive the bytes- Throws:
IOException
- if an I/O error occurs- See Also:
-
equalsRange
Check equality of the substring of given length of this object starting at zero with anotherByteString
substring 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.
-