Classes | |
class | AbstractByteIterator |
class | ArraysByteArrayCopier |
interface | ByteArrayCopier |
interface | ByteIterator |
class | SystemByteArrayCopier |
Public Member Functions | |
abstract byte | byteAt (int index) |
final boolean | isEmpty () |
ByteIterator | iterator () |
abstract int | size () |
Static Public Attributes | |
static final ByteString | EMPTY = new LiteralByteString(Internal.EMPTY_BYTE_ARRAY) |
Static Private Member Functions | |
static int | toInt (byte value) |
Private Attributes | |
int | hash = 0 |
Static Private Attributes | |
static final ByteArrayCopier | byteArrayCopier |
static final int | UNSIGNED_BYTE_MASK = 0xFF |
static final Comparator< ByteString > | UNSIGNED_LEXICOGRAPHICAL_COMPARATOR |
Immutable sequence of bytes. Substring is supported by sharing the reference to the immutable underlying bytes. Concatenation is likewise supported without copying (long strings) by building a tree of pieces in 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.
Definition at line 67 of file ByteString.java.
|
abstract |
Gets the byte at the given index. This method should be used only for random access to individual bytes. To access bytes sequentially, use the ByteIterator returned by {}, and call #substring(int, int)} first if necessary. index index of byte the value IndexOutOfBoundsException index < 0 or index >= size
|
inline |
Returns
if the size is
,
otherwise.
Definition at line 225 of file ByteString.java.
|
inline |
Return a ByteString.ByteIterator over the bytes in the ByteString. To avoid auto-boxing, you may get the iterator manually and call ByteIterator#nextByte().
Definition at line 165 of file ByteString.java.
|
abstract |
Gets the number of bytes.
|
inlinestaticprivate |
Returns the value of the given byte as an integer, interpreting the byte as an unsigned value. That is, returns
if
is negative;
itself otherwise.
Note: This code was copied from com.google.common.primitives.UnsignedBytes#toInt, as Guava libraries cannot be used in the
package.
Definition at line 242 of file ByteString.java.
|
staticprivate |
Definition at line 121 of file ByteString.java.
|
static |
|
private |
Cached hash value. Intentionally accessed via a data race, which is safe because of the Java Memory Model's "no out-of-thin-air values" guarantees for ints. A value of 0 implies that the hash has not been set.
Definition at line 133 of file ByteString.java.
|
staticprivate |
Definition at line 232 of file ByteString.java.
|
staticprivate |
Compares two ByteStrings lexicographically, treating their contents as unsigned byte values between 0 and 255 (inclusive).
For example,
is considered to be greater than
because it is interpreted as an unsigned value,
.
Definition at line 253 of file ByteString.java.