public class Charsetfunctions extends Object
Modifier and Type | Field and Description |
---|---|
static CodingErrorAction |
codingErrorAction |
Modifier and Type | Method and Description |
---|---|
static byte[] |
asciiBytes(String s) |
static boolean |
isValidUTF8(ByteBuffer data)
Calling isValidUTF8 with offset 0
|
static boolean |
isValidUTF8(ByteBuffer data,
int off)
Check if the provided BytebBuffer contains a valid utf8 encoded string.
|
static String |
stringAscii(byte[] bytes) |
static String |
stringAscii(byte[] bytes,
int offset,
int length) |
static String |
stringUtf8(byte[] bytes) |
static String |
stringUtf8(ByteBuffer bytes) |
static byte[] |
utf8Bytes(String s) |
public static CodingErrorAction codingErrorAction
public static byte[] utf8Bytes(String s)
public static byte[] asciiBytes(String s)
public static String stringAscii(byte[] bytes)
public static String stringAscii(byte[] bytes, int offset, int length)
public static String stringUtf8(byte[] bytes) throws InvalidDataException
InvalidDataException
public static String stringUtf8(ByteBuffer bytes) throws InvalidDataException
InvalidDataException
public static boolean isValidUTF8(ByteBuffer data, int off)
Using the algorithm "Flexible and Economical UTF-8 Decoder" by Björn Höhrmann (http://bjoern.hoehrmann.de/utf-8/decoder/dfa/)
data
- the ByteBufferoff
- offset (for performance reasons)public static boolean isValidUTF8(ByteBuffer data)
data
- the ByteBufferCopyright © 2018. All rights reserved.