ByteString that wraps around a ByteBuffer.
| Modifier and Type | Field and Description |
|---|---|
| private final ByteBuffer |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public ByteBuffer | asReadOnlyByteBuffer()
Implements abstract com. java.nio.ByteBuffer whose content is equal to the contents of
this byte string.
|
| public List | asReadOnlyByteBufferList()
Implements abstract com. java.nio.ByteBuffer objects such that the concatenation
of their contents is equal to the contents of this byte string.
|
| public byte | byteAt(int
index of byte index)Implements abstract com. |
| public void | copyTo(ByteBuffer
ByteBuffer to copy into. target)Implements abstract com. |
| protected void | copyToInternal(byte[] target, int sourceOffset, int targetOffset, int numberToCopy)
Implements abstract com. copyTo(byte[], int, int, int).
|
| public boolean | equals(Object
the reference object with which to compare. other)Implements abstract com. |
| pack-priv boolean | equalsRange(ByteString
what to compare a substring in other, int offset into other offset, int number of bytes to compare length)Implements abstract com. ByteString substring starting at offset.
|
| public byte | internalByteAt(int
index of byte index)Implements abstract com. |
| public boolean | isValidUtf8()
Implements abstract com. ByteString represents a well-formed UTF-8 byte sequence, such that
the original bytes can be converted to a String object and then round tripped back to bytes
without loss.
|
| public CodedInputStream | newCodedInput()
Implements abstract com. CodedInputStream which can be used to read the bytes.
|
| public InputStream | newInput()
Implements abstract com. InputStream which can be used to read the bytes.
|
| protected int | partialHash(int
starting 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)Implements abstract com. |
| protected int | partialIsValidUtf8(int
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)Implements abstract com. |
| private void | |
| public int | |
| private ByteBuffer | Returns: the requested slice.the beginning index of the slice (inclusive). beginIndex, int the end index of the slice (exclusive). endIndex)Creates a slice of a range of this buffer. |
| public ByteString | substring(int
start at this index beginIndex, int the last character is the one before this index endIndex)Implements abstract com. beginIndex, inclusive, to endIndex, exclusive.
|
| protected String | toStringInternal(Charset
encode using this charset charset)Implements abstract com. String by decoding the bytes using the specified charset.
|
| private Object | |
| public void | writeTo(OutputStream
the output stream to which to write the data. out)Implements abstract com. |
| pack-priv void | writeTo(ByteOutput
the output target to receive the bytes output)Implements abstract com. ByteString to the provided ByteOutput.
|
| pack-priv void | writeToInternal(OutputStream out, int sourceOffset, int numberToWrite)
Implements abstract com. writeTo(OutputStream, int, int) that assumes all error checking has
already been done.
|
| buffer | back to summary |
|---|---|
| private final ByteBuffer buffer | |
| NioByteString | back to summary |
|---|---|
| pack-priv NioByteString(ByteBuffer buffer) | |
| asReadOnlyByteBuffer | back to summary |
|---|---|
| public ByteBuffer asReadOnlyByteBuffer() Implements abstract com. Doc from com. Constructs a read-only
| |
| asReadOnlyByteBufferList | back to summary |
|---|---|
| public List Implements abstract com. Doc from com. Constructs a list of read-only By returning a list, implementations of this method may be able to avoid copying even when there are multiple backing arrays.
| |
| byteAt | back to summary |
|---|---|
| public byte byteAt(int index) Implements abstract com. Doc from com. 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
| |
| copyTo | back to summary |
|---|---|
| public void copyTo(ByteBuffer target) Implements abstract com. Doc from com. Copies bytes into a ByteBuffer. To copy a subset of bytes, you call this method on the return value of
| |
| copyToInternal | back to summary |
|---|---|
| protected void copyToInternal(byte[] target, int sourceOffset, int targetOffset, int numberToCopy) Implements abstract com. Doc from com. Internal (package private) implementation of
| |
| equals | back to summary |
|---|---|
| public boolean equals(Object other) Implements abstract com. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes. | |
| equalsRange | back to summary |
|---|---|
| pack-priv boolean equalsRange(ByteString other, int offset, int length) Implements abstract com. Doc from com. Check equality of the substring of given length of this object starting at zero with another
| |
| internalByteAt | back to summary |
|---|---|
| public byte internalByteAt(int index) Implements abstract com. Doc from com. Gets the byte at the given index, assumes bounds checking has already been performed.
| |
| isValidUtf8 | back to summary |
|---|---|
| public boolean isValidUtf8() Implements abstract com. Doc from com. Tells whether this More precisely, returns
This method returns See the Unicode Standard,
| |
| newCodedInput | back to summary |
|---|---|
| public CodedInputStream newCodedInput() Implements abstract com. Doc from com. Creates a
| |
| newInput | back to summary |
|---|---|
| public InputStream newInput() Implements abstract com. Doc from com. Creates an The The methods in the returned
| |
| partialHash | back to summary |
|---|---|
| protected int partialHash(int h, int offset, int length) Implements abstract com. Doc from com. Compute the hash across the value bytes starting with the given hash, and return the result. This is used to compute the hash across strings represented as a set of pieces by allowing the hash computation to be continued from piece to piece.
| |
| partialIsValidUtf8 | back to summary |
|---|---|
| protected int partialIsValidUtf8(int state, int offset, int length) Implements abstract com. Doc from com. Tells whether the given byte sequence is a well-formed, malformed, or incomplete UTF-8 byte
sequence. This method accepts and returns a partial state result, allowing the bytes for a
complete UTF-8 byte sequence to be composed from multiple
| |
| readObject | back to summary |
|---|---|
| private void readObject(ObjectInputStream in) throws IOException Magic method that lets us override deserialization behavior. | |
| size | back to summary |
|---|---|
| public int size() Implements abstract com. Doc from com. Gets the number of bytes.
| |
| slice | back to summary |
|---|---|
| private ByteBuffer slice(int beginIndex, int endIndex) Creates a slice of a range of this buffer.
| |
| substring | back to summary |
|---|---|
| public ByteString substring(int beginIndex, int endIndex) Implements abstract com. Doc from com. Return the substring from
| |
| toStringInternal | back to summary |
|---|---|
| protected String toStringInternal(Charset charset) Implements abstract com. Doc from com. Constructs a new | |
| writeReplace | back to summary |
|---|---|
| private Object writeReplace() Magic method that lets us override serialization behavior. | |
| writeTo | back to summary |
|---|---|
| public void writeTo(OutputStream out) throws IOException Implements abstract com. Doc from com. Writes a copy of the contents of this byte string to the specified output stream argument.
| |
| writeTo | back to summary |
|---|---|
| pack-priv void writeTo(ByteOutput output) throws IOException Implements abstract com. Doc from com. Writes this This method may expose internal backing buffers of the
| |
| writeToInternal | back to summary |
|---|---|
| pack-priv void writeToInternal(OutputStream out, int sourceOffset, int numberToWrite) throws IOException Implements abstract com. Doc from com. Internal version of
| |