Package com.google.zxing.pdf417.decoder
Class DecodedBitStreamParser
- java.lang.Object
-
- com.google.zxing.pdf417.decoder.DecodedBitStreamParser
-
final class DecodedBitStreamParser extends java.lang.Object
This class contains the methods for decoding the PDF417 codewords.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
DecodedBitStreamParser.Mode
-
Field Summary
Fields Modifier and Type Field Description private static int
AL
private static int
AS
private static int
BEGIN_MACRO_PDF417_CONTROL_BLOCK
private static int
BEGIN_MACRO_PDF417_OPTIONAL_FIELD
private static int
BYTE_COMPACTION_MODE_LATCH
private static int
BYTE_COMPACTION_MODE_LATCH_6
private static int
ECI_CHARSET
private static int
ECI_GENERAL_PURPOSE
private static int
ECI_USER_DEFINED
private static java.math.BigInteger[]
EXP900
Table containing values for the exponent of 900.private static int
LL
private static int
MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE
private static int
MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM
private static int
MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME
private static int
MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE
private static int
MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT
private static int
MACRO_PDF417_OPTIONAL_FIELD_SENDER
private static int
MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP
private static int
MACRO_PDF417_TERMINATOR
private static int
MAX_NUMERIC_CODEWORDS
private static char[]
MIXED_CHARS
private static int
ML
private static int
MODE_SHIFT_TO_BYTE_COMPACTION_MODE
private static int
NUMBER_OF_SEQUENCE_CODEWORDS
private static int
NUMERIC_COMPACTION_MODE_LATCH
private static int
PAL
private static int
PL
private static int
PS
private static char[]
PUNCT_CHARS
private static int
TEXT_COMPACTION_MODE_LATCH
-
Constructor Summary
Constructors Modifier Constructor Description private
DecodedBitStreamParser()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static int
byteCompaction(int mode, int[] codewords, int codeIndex, ECIStringBuilder result)
Byte Compaction mode (see 5.4.3) permits all 256 possible 8-bit byte values to be encoded.(package private) static DecoderResult
decode(int[] codewords, java.lang.String ecLevel)
private static java.lang.String
decodeBase900toBase10(int[] codewords, int count)
Convert a list of Numeric Compacted codewords from Base 900 to Base 10.(package private) static int
decodeMacroBlock(int[] codewords, int codeIndex, PDF417ResultMetadata resultMetadata)
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.private static int
numericCompaction(int[] codewords, int codeIndex, ECIStringBuilder result)
Numeric Compaction mode (see 5.4.4) permits efficient encoding of numeric data strings.private static int
textCompaction(int[] codewords, int codeIndex, ECIStringBuilder result)
Text Compaction mode (see 5.4.1.5) permits all printable ASCII characters to be encoded, i.e.
-
-
-
Field Detail
-
TEXT_COMPACTION_MODE_LATCH
private static final int TEXT_COMPACTION_MODE_LATCH
- See Also:
- Constant Field Values
-
BYTE_COMPACTION_MODE_LATCH
private static final int BYTE_COMPACTION_MODE_LATCH
- See Also:
- Constant Field Values
-
NUMERIC_COMPACTION_MODE_LATCH
private static final int NUMERIC_COMPACTION_MODE_LATCH
- See Also:
- Constant Field Values
-
BYTE_COMPACTION_MODE_LATCH_6
private static final int BYTE_COMPACTION_MODE_LATCH_6
- See Also:
- Constant Field Values
-
ECI_USER_DEFINED
private static final int ECI_USER_DEFINED
- See Also:
- Constant Field Values
-
ECI_GENERAL_PURPOSE
private static final int ECI_GENERAL_PURPOSE
- See Also:
- Constant Field Values
-
ECI_CHARSET
private static final int ECI_CHARSET
- See Also:
- Constant Field Values
-
BEGIN_MACRO_PDF417_CONTROL_BLOCK
private static final int BEGIN_MACRO_PDF417_CONTROL_BLOCK
- See Also:
- Constant Field Values
-
BEGIN_MACRO_PDF417_OPTIONAL_FIELD
private static final int BEGIN_MACRO_PDF417_OPTIONAL_FIELD
- See Also:
- Constant Field Values
-
MACRO_PDF417_TERMINATOR
private static final int MACRO_PDF417_TERMINATOR
- See Also:
- Constant Field Values
-
MODE_SHIFT_TO_BYTE_COMPACTION_MODE
private static final int MODE_SHIFT_TO_BYTE_COMPACTION_MODE
- See Also:
- Constant Field Values
-
MAX_NUMERIC_CODEWORDS
private static final int MAX_NUMERIC_CODEWORDS
- See Also:
- Constant Field Values
-
MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME
private static final int MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME
- See Also:
- Constant Field Values
-
MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT
private static final int MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT
- See Also:
- Constant Field Values
-
MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP
private static final int MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP
- See Also:
- Constant Field Values
-
MACRO_PDF417_OPTIONAL_FIELD_SENDER
private static final int MACRO_PDF417_OPTIONAL_FIELD_SENDER
- See Also:
- Constant Field Values
-
MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE
private static final int MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE
- See Also:
- Constant Field Values
-
MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE
private static final int MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE
- See Also:
- Constant Field Values
-
MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM
private static final int MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM
- See Also:
- Constant Field Values
-
PL
private static final int PL
- See Also:
- Constant Field Values
-
LL
private static final int LL
- See Also:
- Constant Field Values
-
AS
private static final int AS
- See Also:
- Constant Field Values
-
ML
private static final int ML
- See Also:
- Constant Field Values
-
AL
private static final int AL
- See Also:
- Constant Field Values
-
PS
private static final int PS
- See Also:
- Constant Field Values
-
PAL
private static final int PAL
- See Also:
- Constant Field Values
-
PUNCT_CHARS
private static final char[] PUNCT_CHARS
-
MIXED_CHARS
private static final char[] MIXED_CHARS
-
EXP900
private static final java.math.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:
- Constant Field Values
-
-
Method Detail
-
decode
static DecoderResult decode(int[] codewords, java.lang.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 924codewords
- 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 java.lang.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 codewordscount
- The number of codewords- Returns:
- The decoded string representing the Numeric data.
- Throws:
FormatException
-
-