java.lang.Object
java.lang.Enum<Mode>
com.google.zxing.qrcode.decoder.Mode
All Implemented Interfaces:
Serializable, Comparable<Mode>, java.lang.constant.Constable

public enum Modeextends Enum<Mode>

See ISO 18004:2006, 6.4.1, Tables 2 and 3. This enum encapsulates the various modes in which data can be encoded to bits in the QR code standard.

  • Nested Class Summary

    Nested classes/interfaces inherited from class Enum

    Enum.EnumDesc<E>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    Alphanumeric mode for encoding letters and digits.
    Byte mode for arbitrary data.
    ECI mode for switching character sets.
    FNC1 first position mode.
    FNC1 second position mode.
    See GBT 18284-2000; "Hanzi" is a transliteration of this mode name.
    Kanji mode for encoding Shift JIS characters.
    Numeric mode for encoding digits.
    Structured append mode for combining QR symbols.
    Terminator mode for ending a QR symbol.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final int
    The four bits naming the mode in the data.
    private final int[]
    Count-field size for each of the three version groups.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
    Mode(int[] characterCountBitsForVersions, int bits)
    Creates a mode with its character-count bit tables.
  • Method Summary

    Modifier and Type
    Method
    Description
    static Mode
    forBits(int bits)
    Look up the data mode a four-bit type field encodes.
    int
    Return the four-bit type field value for this mode.
    int
    Return how many bits the character count field occupies for a version.
    static Mode
    Returns the enum constant of this class with the specified name.
    static Mode[]
    Returns an array containing the constants of this enum class, in the order they are declared.

    Methods inherited from class Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • TERMINATOR

      public static final Mode TERMINATOR
      Terminator mode for ending a QR symbol.
    • NUMERIC

      public static final Mode NUMERIC
      Numeric mode for encoding digits.
    • ALPHANUMERIC

      public static final Mode ALPHANUMERIC
      Alphanumeric mode for encoding letters and digits.
    • STRUCTURED_APPEND

      public static final Mode STRUCTURED_APPEND
      Structured append mode for combining QR symbols.
    • BYTE

      public static final Mode BYTE
      Byte mode for arbitrary data.
    • ECI

      public static final Mode ECI
      ECI mode for switching character sets.
    • KANJI

      public static final Mode KANJI
      Kanji mode for encoding Shift JIS characters.
    • FNC1_FIRST_POSITION

      public static final Mode FNC1_FIRST_POSITION
      FNC1 first position mode.
    • FNC1_SECOND_POSITION

      public static final Mode FNC1_SECOND_POSITION
      FNC1 second position mode.
    • HANZI

      public static final Mode HANZI
      See GBT 18284-2000; "Hanzi" is a transliteration of this mode name.
  • Field Details

    • characterCountBitsForVersions

      private final int[] characterCountBitsForVersions
      Count-field size for each of the three version groups.
    • bits

      private final int bits
      The four bits naming the mode in the data.
  • Constructor Details

    • Mode

      private Mode(int[] characterCountBitsForVersions, int bits)
      Creates a mode with its character-count bit tables.
      Parameters:
      characterCountBitsForVersions - per-version bit counts
      bits - the mode indicator bits
  • Method Details

    • values

      public static Mode[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static Mode valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • forBits

      public static Mode forBits(int bits)
      Look up the data mode a four-bit type field encodes.
      Parameters:
      bits - four bits encoding a QR Code data mode
      Returns:
      Mode encoded by these bits
      Throws:
      IllegalArgumentException - if bits do not correspond to a known mode
    • getCharacterCountBits

      public int getCharacterCountBits(Version version)
      Return how many bits the character count field occupies for a version.
      Parameters:
      version - version in question
      Returns:
      number of bits used, in this QR Code symbol Version, to encode the
    • getBits

      public int getBits()
      Return the four-bit type field value for this mode.
      Returns:
      the four-bit type field value that encodes this mode