-
- All Implemented Interfaces:
-
java.lang.CharSequence
public final class UTF8BytesString implements CharSequence
Class that wraps a
{@code String}and caches the UTF8 byte representation. Implements{@code * CharSequence}so that it can be mixed with normal{@code String}instances.
-
-
Field Summary
Fields Modifier and Type Field Description public final static UTF8BytesStringEMPTYprivate Array<byte>utf8Bytes
-
Method Summary
Modifier and Type Method Description Array<byte>getUtf8Bytes()Writes the UTF8 encoding of the wrapped {@code String}.static UTF8BytesStringcreate(CharSequence sequence)static UTF8BytesStringcreate(Array<byte> utf8Bytes)static UTF8BytesStringcreate(String string, Array<byte> utf8Bytes)static UTF8BytesStringcreate(ByteBuffer utf8BytesBuffer)Creates a new UTF8BytesString instance using the provided ByteBufferAll available data from the current position are read and used as the backing array. voidtransferTo(ByteBuffer buffer)Writes the UTF8 encoding of the wrapped {@code String}.intencodedLength()StringtoString()booleanequals(Object o)inthashCode()intlength()charcharAt(int index)CharSequencesubSequence(int start, int end)-
-
Method Detail
-
getUtf8Bytes
Array<byte> getUtf8Bytes()
Writes the UTF8 encoding of the wrapped
{@code String}.
-
create
static UTF8BytesString create(CharSequence sequence)
-
create
static UTF8BytesString create(Array<byte> utf8Bytes)
-
create
static UTF8BytesString create(String string, Array<byte> utf8Bytes)
-
create
static UTF8BytesString create(ByteBuffer utf8BytesBuffer)
Creates a new UTF8BytesString instance using the provided ByteBufferAll available data from the current position are read and used as the backing array.
- Parameters:
utf8BytesBuffer- the byte buffer containing UTF8 data
-
transferTo
void transferTo(ByteBuffer buffer)
Writes the UTF8 encoding of the wrapped
{@code String}.
-
encodedLength
int encodedLength()
-
hashCode
int hashCode()
-
length
int length()
-
charAt
char charAt(int index)
-
subSequence
CharSequence subSequence(int start, int end)
-
-
-
-