Package com.google.zxing.common
Class StringUtils
- java.lang.Object
-
- com.google.zxing.common.StringUtils
-
public final class StringUtils extends java.lang.ObjectCommon string-related functions.
-
-
Field Summary
Fields Modifier and Type Field Description private static booleanASSUME_SHIFT_JISprivate static java.nio.charset.CharsetEUC_JPstatic java.lang.StringGB2312static java.nio.charset.CharsetGB2312_CHARSETprivate static java.nio.charset.CharsetPLATFORM_DEFAULT_ENCODINGstatic java.lang.StringSHIFT_JISstatic java.nio.charset.CharsetSHIFT_JIS_CHARSET
-
Constructor Summary
Constructors Modifier Constructor Description privateStringUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.nio.charset.CharsetguessCharset(byte[] bytes, java.util.Map<DecodeHintType,?> hints)static java.lang.StringguessEncoding(byte[] bytes, java.util.Map<DecodeHintType,?> hints)
-
-
-
Field Detail
-
PLATFORM_DEFAULT_ENCODING
private static final java.nio.charset.Charset PLATFORM_DEFAULT_ENCODING
-
SHIFT_JIS_CHARSET
public static final java.nio.charset.Charset SHIFT_JIS_CHARSET
-
GB2312_CHARSET
public static final java.nio.charset.Charset GB2312_CHARSET
-
EUC_JP
private static final java.nio.charset.Charset EUC_JP
-
ASSUME_SHIFT_JIS
private static final boolean ASSUME_SHIFT_JIS
-
SHIFT_JIS
public static final java.lang.String SHIFT_JIS
- See Also:
- Constant Field Values
-
GB2312
public static final java.lang.String GB2312
- See Also:
- Constant Field Values
-
-
Method Detail
-
guessEncoding
public static java.lang.String guessEncoding(byte[] bytes, java.util.Map<DecodeHintType,?> hints)- Parameters:
bytes- bytes encoding a string, whose encoding should be guessedhints- decode hints if applicable- Returns:
- name of guessed encoding; at the moment will only guess one of: "SJIS", "UTF8", "ISO8859_1", or the platform default encoding if none of these can possibly be correct
-
guessCharset
public static java.nio.charset.Charset guessCharset(byte[] bytes, java.util.Map<DecodeHintType,?> hints)- Parameters:
bytes- bytes encoding a string, whose encoding should be guessedhints- decode hints if applicable- Returns:
- Charset of guessed encoding; at the moment will only guess one of:
SHIFT_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
-
-