RopeByteString.
Like String, the contents of a ByteString can never be observed to change, not
even in the presence of a data race or incorrect API usage in the client code.
| Modifier and Type | Class and Description |
|---|---|
| pack-priv abstract static class | |
| private static class | ByteString.ArraysByteArrayCopier
Implementation of |
| private static class | ByteString.BoundedByteString
This class is used to represent the substring of a |
| private static interface | ByteString.ByteArrayCopier
An interface to efficiently copy |
| public static interface | ByteString.ByteIterator
This interface extends |
| pack-priv static class | |
| pack-priv abstract static class | ByteString.LeafByteString
Base class for leaf |
| private static class | ByteString.LiteralByteString
This class implements a |
| public static class | ByteString.Output
Outputs to a |
| private static class | ByteString.SystemByteArrayCopier
Implementation of |
| Modifier and Type | Field and Description |
|---|---|
| private static final ByteString. | |
| pack-priv static final int | CONCATENATE_BY_COPY_SIZE
When two strings to be concatenated have a combined length shorter than this, we just copy
their bytes on |
| public static final ByteString | EMPTY
Empty |
| private int | hash
Cached hash value. |
| pack-priv static final int | |
| pack-priv static final int | MIN_READ_FROM_CHUNK_SIZE
When copying an InputStream into a ByteString with .readFrom(), the chunks in the underlying rope start at 256 bytes, but double each iteration up to 8192 bytes. |
| private static final int | |
| private static final Comparator | UNSIGNED_LEXICOGRAPHICAL_COMPARATOR
Compares two |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public abstract ByteBuffer | Returns: wrapped bytesConstructs a read-only |
| public abstract List | Returns: a list of wrapped bytesConstructs a list of read-only |
| private static ByteString | |
| public abstract byte | |
| pack-priv static void | checkIndex(int
the index position to be tested index, int the length of the array size)Checks that the given index falls within the specified array size. |
| pack-priv static int | Returns: the length of the range.the start index of the range (inclusive) startIndex, int the end index of the range (exclusive) endIndex, int the size of the array. size)Checks that the given range falls within the bounds of an array |
| public final ByteString | Returns: a newByteString instancestring to concatenate other)Concatenate the given |
| public static ByteString | Returns: newByteStringsource array bytes, int offset in source array offset, int number of bytes to copy size)Copies the given bytes into a |
| public static ByteString | |
| public static ByteString | Returns: newByteStringsource buffer bytes, int number of bytes to copy size)Copies the next |
| public static ByteString | Returns: newByteStringsourceBuffer bytes)Copies the remaining bytes from a |
| public static ByteString | |
| public static ByteString | |
| public static ByteString | Returns: newByteStringstrings to be concatenated byteStrings)Concatenates all byte strings in the iterable and returns the result. |
| public static ByteString | Returns: newByteStringsource string text)Encodes |
| public void | copyTo(byte[]
buffer to copy into target, int in the target buffer offset)Copies bytes into a buffer at the given offset. |
| public final void | copyTo(byte[]
buffer to copy into target, int offset within these bytes sourceOffset, int offset within the target buffer targetOffset, int number of bytes to copy numberToCopy)
Deprecated
Instead, call
Copies bytes into a buffer.
byteString.substring(sourceOffset, sourceOffset +
numberToCopy).copyTo(target, targetOffset)
|
| public abstract void | |
| protected abstract void | copyToInternal(byte[] target, int sourceOffset, int targetOffset, int numberToCopy)
Internal (package private) implementation of |
| public final boolean | Returns: true if the byte sequence represented by the argument is a suffix of the
byte sequence represented by this string; false otherwise.the suffix. suffix)Tests if this bytestring ends with the specified suffix. |
| public abstract boolean | equals(Object
the reference object with which to compare. o)Overrides java. |
| protected abstract int | Returns: tree depth or zeroReturn the depth of the tree representing this |
| public final int | Returns: hashCode valueOverrides java. ByteString.
|
| pack-priv abstract byte | Returns: the valueindex of byte index)Gets the byte at the given index, assumes bounds checking has already been performed. |
| protected abstract boolean | Returns: true if the tree is flat enoughReturn |
| public final boolean | |
| public abstract boolean | Returns: whether the bytes in thisByteString are a well-formed UTF-8 byte sequenceTells whether this |
| public ByteString. | Returns: the iteratorImplements java. ByteString. over the bytes in the ByteString.
|
| pack-priv static ByteString. | Returns: the builderThe target byte size of the size)ByteString. You must write exactly this many
bytes before building the result.Constructs a new |
| public abstract CodedInputStream | Returns: stream based on wrapped dataCreates a |
| public abstract InputStream | Returns: an input stream that returns the bytes of this byte string.Creates an |
| public static ByteString. | |
| public static ByteString. | |
| protected abstract int | Returns: ending hash valuestarting hash value h, int offset into this value to start looking at data values offset, int number of data values to include in the hash computation length)Compute the hash across the value bytes starting with the given hash, and return the result. |
| protected abstract int | Returns: -1 if the partial byte sequence is definitely malformed, 0 if it is
well-formed (no additional input needed), or, if the byte sequence is "incomplete", i.e.
apparently terminated in the middle of a character, an opaque integer "state" value
containing enough information to decode the character when passed to a subsequent
invocation of a partial decoding method.either state, int 0 (if this is the initial decoding operation) or the value returned
from a call to a partial decoding method for the previous bytesoffset of the first byte to check offset, int number of bytes to check length)Tells whether the given byte sequence is a well-formed, malformed, or incomplete UTF-8 byte sequence. |
| protected final int | Returns: value of cached hash code or 0 if not computed yetReturn the cached hash code if available. |
| private static ByteString | Returns: A chunk of the desired size, or else a chunk as large as was available when end of stream was reached. Returns null if the given stream had no more data in it.Blocks until a chunk of the given size can be made from the stream, or EOF is reached. |
| public static ByteString | Returns: A newByteString which is made up of chunks of various sizes, depending on the
behavior of the underlying stream.The source stream, which is read completely but not closed. streamToDrain)Completely reads the given stream's bytes into a |
| public static ByteString | Returns: A newByteString which is made up of chunks of the given size.The source stream, which is read completely but not closed. streamToDrain, int The size of the chunks in which to read the stream. chunkSize)Completely reads the given stream's bytes into a |
| public static ByteString | |
| public abstract int | |
| public final boolean | Returns: true if the byte sequence represented by the argument is a prefix of the
byte sequence represented by this string; false otherwise.the prefix. prefix)Tests if this bytestring starts with the specified prefix. |
| public final ByteString | Returns: substring sharing underlying datastart at this index beginIndex)Return the substring from |
| public abstract ByteString | Returns: substring sharing underlying datastart at this index beginIndex, int the last character is the one before this index endIndex)Return the substring from |
| public final byte[] | |
| private static int | toInt(byte value)
Returns the value of the given byte as an integer, interpreting the byte as an unsigned value. |
| public final String | |
| public final String | |
| public final String | |
| protected abstract String | Returns: new stringencode using this charset charset)Constructs a new |
| public final String | Returns: new string using UTF-8 encodingConstructs a new |
| public static Comparator | unsignedLexicographicalComparator()
Returns a |
| pack-priv static ByteString | |
| pack-priv static ByteString | |
| pack-priv static ByteString | |
| public abstract void | writeTo(OutputStream
the output stream to which to write the data. out)Writes a copy of the contents of this byte string to the specified output stream argument. |
| pack-priv final void | writeTo(OutputStream
the output stream to which to write the data. out, int offset within these bytes sourceOffset, int number of bytes to write numberToWrite)Writes a specified part of this byte string to an output stream. |
| pack-priv abstract void | writeTo(ByteOutput
the output target to receive the bytes byteOutput)Writes this |
| pack-priv abstract void | writeToInternal(OutputStream out, int sourceOffset, int numberToWrite)
Internal version of |