Package com.google.protobuf
Class ByteString.LeafByteString
- java.lang.Object
-
- com.google.protobuf.ByteString
-
- com.google.protobuf.ByteString.LeafByteString
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Iterable<java.lang.Byte>
- Direct Known Subclasses:
ByteString.LiteralByteString,ByteString.NioByteString
- Enclosing class:
- ByteString
abstract static class ByteString.LeafByteString extends ByteString
Base class for leafByteStrings (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
Fields Modifier and Type Field Description private static longserialVersionUID-
Fields 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 Modifier Constructor Description privateLeafByteString()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description (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 intgetTreeDepth()Return the depth of the tree representing thisByteString, if any, whose root is this node.protected booleanisBalanced()Returntrueif 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, 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
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
-
Method Detail
-
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
void writeToReverse(ByteOutput byteOutput) throws java.io.IOException
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:
java.io.IOException- if an I/O error occurs- See Also:
UnsafeByteOperations#unsafeWriteToReverse(ByteString, ByteOutput)
-
equalsRange
abstract boolean equalsRange(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.- Parameters:
other- what to compare a substring inoffset- offset into otherlength- number of bytes to compare- Returns:
- true for equality of substrings, else false.
-
-