Package com.google.zxing.pdf417.decoder
Class DecodedBitStreamParser
- java.lang.Object
-
- com.google.zxing.pdf417.decoder.DecodedBitStreamParser
-
final class DecodedBitStreamParser extends java.lang.ObjectThis class contains the methods for decoding the PDF417 codewords.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classDecodedBitStreamParser.Mode
-
Field Summary
Fields Modifier and Type Field Description private static intALprivate static intASprivate static intBEGIN_MACRO_PDF417_CONTROL_BLOCKprivate static intBEGIN_MACRO_PDF417_OPTIONAL_FIELDprivate static intBYTE_COMPACTION_MODE_LATCHprivate static intBYTE_COMPACTION_MODE_LATCH_6private static intECI_CHARSETprivate static intECI_GENERAL_PURPOSEprivate static intECI_USER_DEFINEDprivate static java.math.BigInteger[]EXP900Table containing values for the exponent of 900.private static intLLprivate static intMACRO_PDF417_OPTIONAL_FIELD_ADDRESSEEprivate static intMACRO_PDF417_OPTIONAL_FIELD_CHECKSUMprivate static intMACRO_PDF417_OPTIONAL_FIELD_FILE_NAMEprivate static intMACRO_PDF417_OPTIONAL_FIELD_FILE_SIZEprivate static intMACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNTprivate static intMACRO_PDF417_OPTIONAL_FIELD_SENDERprivate static intMACRO_PDF417_OPTIONAL_FIELD_TIME_STAMPprivate static intMACRO_PDF417_TERMINATORprivate static intMAX_NUMERIC_CODEWORDSprivate static char[]MIXED_CHARSprivate static intMLprivate static intMODE_SHIFT_TO_BYTE_COMPACTION_MODEprivate static intNUMBER_OF_SEQUENCE_CODEWORDSprivate static intNUMERIC_COMPACTION_MODE_LATCHprivate static intPALprivate static intPLprivate static intPSprivate static char[]PUNCT_CHARSprivate static intTEXT_COMPACTION_MODE_LATCH
-
Constructor Summary
Constructors Modifier Constructor Description privateDecodedBitStreamParser()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static intbyteCompaction(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 DecoderResultdecode(int[] codewords, java.lang.String ecLevel)private static java.lang.StringdecodeBase900toBase10(int[] codewords, int count)Convert a list of Numeric Compacted codewords from Base 900 to Base 10.(package private) static intdecodeMacroBlock(int[] codewords, int codeIndex, PDF417ResultMetadata resultMetadata)private static DecodedBitStreamParser.ModedecodeTextCompaction(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 intnumericCompaction(int[] codewords, int codeIndex, ECIStringBuilder result)Numeric Compaction mode (see 5.4.4) permits efficient encoding of numeric data strings.private static inttextCompaction(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 FormatExceptionText 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 FormatExceptionByte 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 FormatExceptionNumeric 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 FormatExceptionConvert 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
-
-