Strings to UTF-8. Instances of this class are reusable but are NOT threadsafe.
Instances are vended by Utf8StringEncoderPool#getOrCreate().
encode(String) can be called any number of times. Users are expected to call close() when
the encoder is no longer needed.
| Modifier and Type | Class and Description |
|---|---|
| public static class | Utf8StringEncoder.
Represents the result of a |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final char[] | |
| pack-priv final CharBuffer | |
| private static final int | |
| pack-priv final CharsetEncoder | |
| pack-priv final ByteBuffer |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public Utf8StringEncoder. |
| charArray | back to summary |
|---|---|
| pack-priv final char[] charArray | |
| charBuffer | back to summary |
|---|---|
| pack-priv final CharBuffer charBuffer | |
| SMALL_STRING_SIZE | back to summary |
|---|---|
| private static final int SMALL_STRING_SIZE | |
| utf8Encoder | back to summary |
|---|---|
| pack-priv final CharsetEncoder utf8Encoder | |
| utf8EncodingBuffer | back to summary |
|---|---|
| pack-priv final ByteBuffer utf8EncodingBuffer | |
| Utf8StringEncoder | back to summary |
|---|---|
| pack-priv Utf8StringEncoder(Pool<Utf8StringEncoder> pool) | |
| encode | back to summary |
|---|---|
| public Utf8StringEncoder. Encodes the provided String's text to UTF-8. Unlike
| |
Utf8StringEncoder#encode(String) operation.
| Modifier and Type | Field and Description |
|---|---|
| private final byte[] | |
| private final int |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public byte[] | Returns: the buffer containing UTF-8 bytes.Returns a byte array containing the encoded UTF-8 bytes starting at index 0. |
| public int |
| buffer | back to summary |
|---|---|
| private final byte[] buffer | |
| encodedLength | back to summary |
|---|---|
| private final int encodedLength | |
| Result | back to summary |
|---|---|
| public Result(int encodedLength, byte[] buffer) | |
| getBuffer | back to summary |
|---|---|
| public byte[] getBuffer() Returns a byte array containing the encoded UTF-8 bytes starting at index 0. This byte array is NOT
guaranteed to be the same length as the data it contains. Callers must use
| |
| getEncodedLength | back to summary |
|---|---|
public int getEncodedLength()
| |