Class ByteString.LeafByteString

    • Constructor Detail

      • LeafByteString

        private LeafByteString()
    • Method Detail

      • 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 java.io.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:
        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 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.