Class DecodedBitStreamParser

java.lang.Object
com.google.zxing.pdf417.decoder.DecodedBitStreamParser

final class DecodedBitStreamParser extends Object

This class contains the methods for decoding the PDF417 codewords.

  • Field Details

    • TEXT_COMPACTION_MODE_LATCH

      private static final int TEXT_COMPACTION_MODE_LATCH
      See Also:
    • BYTE_COMPACTION_MODE_LATCH

      private static final int BYTE_COMPACTION_MODE_LATCH
      See Also:
    • NUMERIC_COMPACTION_MODE_LATCH

      private static final int NUMERIC_COMPACTION_MODE_LATCH
      See Also:
    • BYTE_COMPACTION_MODE_LATCH_6

      private static final int BYTE_COMPACTION_MODE_LATCH_6
      See Also:
    • ECI_USER_DEFINED

      private static final int ECI_USER_DEFINED
      See Also:
    • ECI_GENERAL_PURPOSE

      private static final int ECI_GENERAL_PURPOSE
      See Also:
    • ECI_CHARSET

      private static final int ECI_CHARSET
      See Also:
    • BEGIN_MACRO_PDF417_CONTROL_BLOCK

      private static final int BEGIN_MACRO_PDF417_CONTROL_BLOCK
      See Also:
    • BEGIN_MACRO_PDF417_OPTIONAL_FIELD

      private static final int BEGIN_MACRO_PDF417_OPTIONAL_FIELD
      See Also:
    • MACRO_PDF417_TERMINATOR

      private static final int MACRO_PDF417_TERMINATOR
      See Also:
    • MODE_SHIFT_TO_BYTE_COMPACTION_MODE

      private static final int MODE_SHIFT_TO_BYTE_COMPACTION_MODE
      See Also:
    • MAX_NUMERIC_CODEWORDS

      private static final int MAX_NUMERIC_CODEWORDS
      See Also:
    • MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME

      private static final int MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME
      See Also:
    • MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT

      private static final int MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT
      See Also:
    • MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP

      private static final int MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP
      See Also:
    • MACRO_PDF417_OPTIONAL_FIELD_SENDER

      private static final int MACRO_PDF417_OPTIONAL_FIELD_SENDER
      See Also:
    • MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE

      private static final int MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE
      See Also:
    • MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE

      private static final int MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE
      See Also:
    • MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM

      private static final int MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM
      See Also:
    • PL

      private static final int PL
      See Also:
    • LL

      private static final int LL
      See Also:
    • AS

      private static final int AS
      See Also:
    • ML

      private static final int ML
      See Also:
    • AL

      private static final int AL
      See Also:
    • PS

      private static final int PS
      See Also:
    • PAL

      private static final int PAL
      See Also:
    • PUNCT_CHARS

      private static final char[] PUNCT_CHARS
    • MIXED_CHARS

      private static final char[] MIXED_CHARS
    • EXP900

      private static final BigInteger[] EXP900
      Table containing values for the exponent of 900. This is used in the numeric compaction decode algorithm.
    • NUMBER_OF_SEQUENCE_CODEWORDS

      private static final int NUMBER_OF_SEQUENCE_CODEWORDS
      See Also:
  • Constructor Details

    • DecodedBitStreamParser

      private DecodedBitStreamParser()
  • Method Details

    • decode

      static DecoderResult decode(int[] codewords, String ecLevel) throws FormatException
      Throws:
      FormatException
    • decodeMacroBlock

      static int decodeMacroBlock(int[] codewords, int codeIndex, PDF417ResultMetadata resultMetadata) throws FormatException
      Throws:
      FormatException
    • textCompaction

      private static int textCompaction(int[] codewords, int codeIndex, ECIStringBuilder result) throws FormatException
      Text Compaction mode (see 5.4.1.5) permits all printable ASCII characters to be encoded, i.e. values 32 - 126 inclusive in accordance with ISO/IEC 646 (IRV), as well as selected control characters.
      Parameters:
      codewords - The array of codewords (data + error)
      codeIndex - The current index into the codeword array.
      result - The decoded data is appended to the result.
      Returns:
      The next index into the codeword array.
      Throws:
      FormatException
    • decodeTextCompaction

      private static DecodedBitStreamParser.Mode decodeTextCompaction(int[] textCompactionData, int[] byteCompactionData, int length, ECIStringBuilder result, DecodedBitStreamParser.Mode startMode)
      The Text Compaction mode includes all the printable ASCII characters (i.e. values from 32 to 126) and three ASCII control characters: HT or tab (ASCII value 9), LF or line feed (ASCII value 10), and CR or carriage return (ASCII value 13). The Text Compaction mode also includes various latch and shift characters which are used exclusively within the mode. The Text Compaction mode encodes up to 2 characters per codeword. The compaction rules for converting data into PDF417 codewords are defined in 5.4.2.2. The sub-mode switches are defined in 5.4.2.3.
      Parameters:
      textCompactionData - The text compaction data.
      byteCompactionData - The byte compaction data if there was a mode shift.
      length - The size of the text compaction and byte compaction data.
      result - The decoded data is appended to the result.
      startMode - The mode in which decoding starts
      Returns:
      The mode in which decoding ended
    • byteCompaction

      private static int byteCompaction(int mode, int[] codewords, int codeIndex, ECIStringBuilder result) throws FormatException
      Byte Compaction mode (see 5.4.3) permits all 256 possible 8-bit byte values to be encoded. This includes all ASCII characters value 0 to 127 inclusive and provides for international character set support.
      Parameters:
      mode - The byte compaction mode i.e. 901 or 924
      codewords - The array of codewords (data + error)
      codeIndex - The current index into the codeword array.
      result - The decoded data is appended to the result.
      Returns:
      The next index into the codeword array.
      Throws:
      FormatException
    • numericCompaction

      private static int numericCompaction(int[] codewords, int codeIndex, ECIStringBuilder result) throws FormatException
      Numeric Compaction mode (see 5.4.4) permits efficient encoding of numeric data strings.
      Parameters:
      codewords - The array of codewords (data + error)
      codeIndex - The current index into the codeword array.
      result - The decoded data is appended to the result.
      Returns:
      The next index into the codeword array.
      Throws:
      FormatException
    • decodeBase900toBase10

      private static String decodeBase900toBase10(int[] codewords, int count) throws FormatException
      Convert a list of Numeric Compacted codewords from Base 900 to Base 10.
      Parameters:
      codewords - The array of codewords
      count - The number of codewords
      Returns:
      The decoded string representing the Numeric data.
      Throws:
      FormatException