Class Decoder

java.lang.Object
com.google.zxing.aztec.decoder.Decoder

public final class Decoder extends Object

The main class which implements Aztec Code decoding -- as opposed to locating and extracting the Aztec Code from an image.

  • Field Details

    • UPPER_TABLE

      private static final String[] UPPER_TABLE
    • LOWER_TABLE

      private static final String[] LOWER_TABLE
    • MIXED_TABLE

      private static final String[] MIXED_TABLE
    • PUNCT_TABLE

      private static final String[] PUNCT_TABLE
    • DIGIT_TABLE

      private static final String[] DIGIT_TABLE
    • DEFAULT_ENCODING

      private static final Charset DEFAULT_ENCODING
    • ddata

      private AztecDetectorResult ddata
  • Constructor Details

    • Decoder

      public Decoder()
  • Method Details

    • decode

      public DecoderResult decode(AztecDetectorResult detectorResult) throws FormatException
      Throws:
      FormatException
    • highLevelDecode

      public static String highLevelDecode(boolean[] correctedBits) throws FormatException
      Throws:
      FormatException
    • getEncodedData

      private static String getEncodedData(boolean[] correctedBits) throws FormatException
      Gets the string encoded in the aztec code bits
      Returns:
      the decoded string
      Throws:
      FormatException
    • getTable

      private static Decoder.Table getTable(char t)
      gets the table corresponding to the char passed
    • getCharacter

      private static String getCharacter(Decoder.Table table, int code)
      Gets the character (or string) corresponding to the passed code in the given table
      Parameters:
      table - the table used
      code - the code of the character
    • correctBits

      private Decoder.CorrectedBitsResult correctBits(boolean[] rawbits) throws FormatException

      Performs RS error correction on an array of bits.

      Returns:
      the corrected array
      Throws:
      FormatException - if the input contains too many errors
    • extractBits

      private boolean[] extractBits(BitMatrix matrix)
      Gets the array of bits from an Aztec Code matrix
      Returns:
      the array of bits
    • readCode

      private static int readCode(boolean[] rawbits, int startIndex, int length)
      Reads a code of given length and at given index in an array of bits
    • readByte

      private static byte readByte(boolean[] rawbits, int startIndex)
      Reads a code of length 8 in an array of bits, padding with zeros
    • convertBoolArrayToByteArray

      static byte[] convertBoolArrayToByteArray(boolean[] boolArr)
      Packs a bit array into bytes, most significant bit first
    • totalBitsInLayer

      private static int totalBitsInLayer(int layers, boolean compact)