@NotThreadSafe public final class StringEncoder extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
BYTE_BUFFER_SIZE |
static int |
CHAR_BUFFER_SIZE |
static int |
UTF8_MAX_BYTES_PER_CHAR |
| Constructor and Description |
|---|
StringEncoder(Charset aCharset) |
| Modifier and Type | Method and Description |
|---|---|
EFinish |
encode(String sSource,
ByteBuffer aDestBuffer)
Encodes string into destination.
|
byte[] |
getAsNewArray(String sSource)
Returns a new byte array containing the UTF-8 version of source.
|
ByteBuffer |
getAsNewByteBuffer(String sSource)
Returns a ByteBuffer containing the encoded version of source.
|
void |
reset() |
public static final int CHAR_BUFFER_SIZE
public static final int BYTE_BUFFER_SIZE
public static final int UTF8_MAX_BYTES_PER_CHAR
@Nonnull public EFinish encode(@Nonnull String sSource, @Nonnull ByteBuffer aDestBuffer)
sSource - Source stringaDestBuffer - a ByteBuffer that will be filled with data.EFinish@Nonnull public ByteBuffer getAsNewByteBuffer(@Nonnull String sSource)
sSource - Source string@Nonnull @ReturnsMutableCopy public byte[] getAsNewArray(@Nonnull String sSource)
sSource - Source stringpublic void reset()
Copyright © 2014–2016 Philip Helger. All rights reserved.