-
public class Charsetfunctions
-
-
Method Summary
Modifier and Type Method Description static Array<byte>utf8Bytes(String s)static Array<byte>asciiBytes(String s)static StringstringAscii(Array<byte> bytes)static StringstringAscii(Array<byte> bytes, int offset, int length)static StringstringUtf8(Array<byte> bytes)static StringstringUtf8(ByteBuffer bytes)static booleanisValidUTF8(ByteBuffer data, int off)Check if the provided BytebBuffer contains a valid utf8 encoded string. static booleanisValidUTF8(ByteBuffer data)Calling isValidUTF8 with offset 0 -
-
Method Detail
-
asciiBytes
static Array<byte> asciiBytes(String s)
-
stringAscii
static String stringAscii(Array<byte> bytes)
-
stringAscii
static String stringAscii(Array<byte> bytes, int offset, int length)
-
stringUtf8
static String stringUtf8(Array<byte> bytes)
-
stringUtf8
static String stringUtf8(ByteBuffer bytes)
-
isValidUTF8
static boolean isValidUTF8(ByteBuffer data, int off)
Check if the provided BytebBuffer contains a valid utf8 encoded string.
Using the algorithm "Flexible and Economical UTF-8 Decoder" by Björn Höhrmann(http://bjoern.hoehrmann.de/utf-8/decoder/dfa/)
- Parameters:
data- the ByteBufferoff- offset (for performance reasons)
-
isValidUTF8
static boolean isValidUTF8(ByteBuffer data)
Calling isValidUTF8 with offset 0
- Parameters:
data- the ByteBuffer
-
-
-
-