public class CharsetUtil extends Object
Utf8.isWellFormed(byte[])| Modifier and Type | Field and Description |
|---|---|
static org.slf4j.Logger |
CHARSET_MONITOR_LOG |
static int |
MODE_ASSERT |
static int |
MODE_MONITOR |
| Constructor and Description |
|---|
CharsetUtil() |
| Modifier and Type | Method and Description |
|---|---|
static void |
assertUTF8WellFormed(byte[] bytes)
Asserts the given byte array is well formed in UTF-8 encoding format.
|
static void |
assertUTF8WellFormed(byte[] bytes,
int off,
int len)
Asserts that a portion of the given byte array is well formed in UTF-8 encoding format.
|
static void |
checkUTF8WellFormed(byte[] bytes,
int mode)
Checks whether the given byte array is well formed in UTF-8 encoding format.
|
static void |
checkUTF8WellFormed(byte[] bytes,
int off,
int len,
int mode)
Checks whether a portion of the given byte array is well formed in UTF-8 encoding format.
|
static boolean |
isUTF8WellFormed(byte[] bytes)
Determines whether the given byte array is well formed in UTF-8 encoding format according to Unicode 6.0.
|
static boolean |
isUTF8WellFormed(byte[] bytes,
int off,
int len)
Determines whether a portion of the given byte array is well formed in UTF-8 encoding format according to Unicode 6.0.
|
static void |
monitorUTF8WellFormed(byte[] bytes)
Monitor the given byte array is well formed in UTF-8 encoding format.
|
static void |
monitorUTF8WellFormed(byte[] bytes,
int off,
int len)
Monitor that a portion of the given byte array is well formed in UTF-8 encoding format.
|
public static org.slf4j.Logger CHARSET_MONITOR_LOG
public static final int MODE_ASSERT
public static final int MODE_MONITOR
public static void assertUTF8WellFormed(byte[] bytes)
bytes - The byte array to be checked.public static void assertUTF8WellFormed(byte[] bytes,
int off,
int len)
bytes - The byte array to be checked.off - The starting position in the array to be checked.len - The length of the portion to be checked.public static void monitorUTF8WellFormed(byte[] bytes)
bytes - The byte array to be checked.public static void monitorUTF8WellFormed(byte[] bytes,
int off,
int len)
bytes - The byte array to be checked.off - The starting position in the array to be checked.len - The length of the portion to be checked.public static void checkUTF8WellFormed(byte[] bytes,
int mode)
bytes - The byte array to be checked.mode - The checking mode when bytes isn't well formed in UTF-8 encoding forma .
In mode 0, it will throw IllegalArgumentException.
In mode 1, it will print error log in slf4j logger: CHARSET_MONITOR_LOG
public static void checkUTF8WellFormed(byte[] bytes,
int off,
int len,
int mode)
bytes - The byte array to be checked.off - The starting position in the array to be checked.len - The length of the portion to be checked.mode - The checking mode when bytes isn't well formed in UTF-8 encoding forma .
In mode 0, it will throw IllegalArgumentException.
In mode 1, it will print error log in slf4j logger: CHARSET_MONITOR_LOG
public static boolean isUTF8WellFormed(byte[] bytes)
bytes - The byte array to be checked.public static boolean isUTF8WellFormed(byte[] bytes,
int off,
int len)
bytes - The byte array to be checked.off - The starting position in the array to be checked.len - The length of the portion to be checked.Utf8.isWellFormed(byte[], int, int)Copyright © 2024. All rights reserved.