public class Charsetfunctions
extends java.lang.Object
| 限定符和类型 | 字段和说明 |
|---|---|
static java.nio.charset.CodingErrorAction |
codingErrorAction |
| 限定符和类型 | 方法和说明 |
|---|---|
static byte[] |
asciiBytes(java.lang.String s) |
static boolean |
isValidUTF8(java.nio.ByteBuffer data)
Calling isValidUTF8 with offset 0
|
static boolean |
isValidUTF8(java.nio.ByteBuffer data,
int off)
Check if the provided BytebBuffer contains a valid utf8 encoded string.
|
static java.lang.String |
stringAscii(byte[] bytes) |
static java.lang.String |
stringAscii(byte[] bytes,
int offset,
int length) |
static java.lang.String |
stringUtf8(byte[] bytes) |
static java.lang.String |
stringUtf8(java.nio.ByteBuffer bytes) |
static byte[] |
utf8Bytes(java.lang.String s) |
public static byte[] utf8Bytes(java.lang.String s)
public static byte[] asciiBytes(java.lang.String s)
public static java.lang.String stringAscii(byte[] bytes)
public static java.lang.String stringAscii(byte[] bytes,
int offset,
int length)
public static java.lang.String stringUtf8(byte[] bytes)
throws InvalidDataException
public static java.lang.String stringUtf8(java.nio.ByteBuffer bytes)
throws InvalidDataException
public static boolean isValidUTF8(java.nio.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(java.nio.ByteBuffer data)
data - the ByteBuffer