public final class StringUtils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private static boolean |
ASSUME_SHIFT_JIS |
private static java.nio.charset.Charset |
EUC_JP |
static java.lang.String |
GB2312 |
static java.nio.charset.Charset |
GB2312_CHARSET |
private static java.nio.charset.Charset |
PLATFORM_DEFAULT_ENCODING |
static java.lang.String |
SHIFT_JIS |
static java.nio.charset.Charset |
SHIFT_JIS_CHARSET |
Modifier | Constructor and Description |
---|---|
private |
StringUtils() |
Modifier and Type | Method and Description |
---|---|
static java.nio.charset.Charset |
guessCharset(byte[] bytes,
java.util.Map<DecodeHintType,?> hints) |
static java.lang.String |
guessEncoding(byte[] bytes,
java.util.Map<DecodeHintType,?> hints) |
private static final java.nio.charset.Charset PLATFORM_DEFAULT_ENCODING
public static final java.nio.charset.Charset SHIFT_JIS_CHARSET
public static final java.nio.charset.Charset GB2312_CHARSET
private static final java.nio.charset.Charset EUC_JP
private static final boolean ASSUME_SHIFT_JIS
public static final java.lang.String SHIFT_JIS
public static final java.lang.String GB2312
public static java.lang.String guessEncoding(byte[] bytes, java.util.Map<DecodeHintType,?> hints)
bytes
- bytes encoding a string, whose encoding should be guessedhints
- decode hints if applicablepublic static java.nio.charset.Charset guessCharset(byte[] bytes, java.util.Map<DecodeHintType,?> hints)
bytes
- bytes encoding a string, whose encoding should be guessedhints
- decode hints if applicableSHIFT_JIS_CHARSET
, StandardCharsets.UTF_8
,
StandardCharsets.ISO_8859_1
, StandardCharsets.UTF_16
,
or the platform default encoding if
none of these can possibly be correct