Class StringUtils

java.lang.Object
com.google.zxing.common.StringUtils

public final class StringUtils extends Object
Common string-related functions.
  • Field Details

    • PLATFORM_DEFAULT_ENCODING

      private static final Charset PLATFORM_DEFAULT_ENCODING
    • SHIFT_JIS_CHARSET

      public static final Charset SHIFT_JIS_CHARSET
    • GB2312_CHARSET

      public static final Charset GB2312_CHARSET
    • EUC_JP

      private static final Charset EUC_JP
    • ASSUME_SHIFT_JIS

      private static final boolean ASSUME_SHIFT_JIS
    • SHIFT_JIS

      public static final String SHIFT_JIS
      See Also:
    • GB2312

      public static final String GB2312
      See Also:
  • Constructor Details

    • StringUtils

      private StringUtils()
  • Method Details

    • guessEncoding

      public static String guessEncoding(byte[] bytes, Map<DecodeHintType,?> hints)
      Parameters:
      bytes - bytes encoding a string, whose encoding should be guessed
      hints - 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 Charset guessCharset(byte[] bytes, Map<DecodeHintType,?> hints)
      Parameters:
      bytes - bytes encoding a string, whose encoding should be guessed
      hints - 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