StringUtils (ZXing 3.5.0 API)

com.google.zxing.common

## Class StringUtils

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

-     public final class StringUtils
      extends Object

  Common string-related functions.
  Author:
    Sean Owen, Alex Dupre

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `GB2312`
    `static Charset` | `GB2312_CHARSET`
    `static String` | `SHIFT_JIS`
    `static Charset` | `SHIFT_JIS_CHARSET`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static Charset` | `guessCharset(byte[] bytes, Map<DecodeHintType,?> hints)`
    `static String` | `guessEncoding(byte[] bytes, Map<DecodeHintType,?> hints)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### SHIFT_JIS_CHARSET

          public static final Charset SHIFT_JIS_CHARSET

    - #### GB2312_CHARSET

          public static final Charset GB2312_CHARSET

    - #### SHIFT_JIS

          public static final String SHIFT_JIS

      See Also:
        Constant Field Values

    - #### GB2312

          public static final String GB2312

      See Also:
        Constant Field Values

  - ### Method Detail

    - #### 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

Copyright © 2007–2022. All rights reserved.