Enum Mode

  • All Implemented Interfaces:
    Serializable, Comparable<Mode>

    public enum Mode
    extends 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.

    Author:
    Sean Owen
    • Enum Constant Detail

      • TERMINATOR

        public static final Mode TERMINATOR
      • NUMERIC

        public static final Mode NUMERIC
      • ALPHANUMERIC

        public static final Mode ALPHANUMERIC
      • STRUCTURED_APPEND

        public static final Mode STRUCTURED_APPEND
      • BYTE

        public static final Mode BYTE
      • ECI

        public static final Mode ECI
      • KANJI

        public static final Mode KANJI
      • FNC1_FIRST_POSITION

        public static final Mode FNC1_FIRST_POSITION
      • FNC1_SECOND_POSITION

        public static final Mode FNC1_SECOND_POSITION
      • HANZI

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

      • values

        public static Mode[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (Mode c : Mode.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static Mode valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type has no constant with the specified name
        NullPointerException - if the argument is null
      • forBits

        public static Mode forBits​(int bits)
        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)
        Parameters:
        version - version in question
        Returns:
        number of bits used, in this QR Code symbol Version, to encode the count of characters that will follow encoded in this Mode
      • getBits

        public int getBits()