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

abstract static class ByteString.LeafByteString extends ByteString
Base class for leaf ByteStrings (i.e. non-ropes).
  • Field Details

  • Constructor Details

    • LeafByteString

      private LeafByteString()
  • Method Details

    • getTreeDepth

      protected final int getTreeDepth()
      Description copied from class: ByteString
      Return the depth of the tree representing this ByteString, if any, whose root is this node. If this is a leaf node, return 0.
      Specified by:
      getTreeDepth in class ByteString
      Returns:
      tree depth or zero
    • isBalanced

      protected final boolean isBalanced()
      Description copied from class: ByteString
      Return true if this ByteString is literal (a leaf node) or a flat-enough tree in the sense of RopeByteString.
      Specified by:
      isBalanced in class ByteString
      Returns:
      true if the tree is flat enough
    • writeToReverse

      void writeToReverse(ByteOutput byteOutput) throws IOException
      Description copied from class: ByteString
      This method behaves exactly the same as ByteString.writeTo(ByteOutput) unless the ByteString is a rope. For ropes, the leaf nodes are written in reverse order to the byteOutput.
      Specified by:
      writeToReverse in class ByteString
      Parameters:
      byteOutput - the output target to receive the bytes
      Throws:
      IOException - if an I/O error occurs
      See Also:
      • invalid reference
        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 another ByteString substring starting at offset.
      Parameters:
      other - what to compare a substring in
      offset - offset into other
      length - number of bytes to compare
      Returns:
      true for equality of substrings, else false.