Package com.google.zxing.aztec.decoder
Class Decoder
java.lang.Object
com.google.zxing.aztec.decoder.Decoder
The main class which implements Aztec Code decoding -- as opposed to locating and extracting the Aztec Code from an image.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static final class
private static enum
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static byte[]
convertBoolArrayToByteArray
(boolean[] boolArr) Packs a bit array into bytes, most significant bit firstprivate Decoder.CorrectedBitsResult
correctBits
(boolean[] rawbits) Performs RS error correction on an array of bits.decode
(AztecDetectorResult detectorResult) private boolean[]
extractBits
(BitMatrix matrix) Gets the array of bits from an Aztec Code matrixprivate static String
getCharacter
(Decoder.Table table, int code) Gets the character (or string) corresponding to the passed code in the given tableprivate static String
getEncodedData
(boolean[] correctedBits) Gets the string encoded in the aztec code bitsprivate static Decoder.Table
getTable
(char t) gets the table corresponding to the char passedstatic String
highLevelDecode
(boolean[] correctedBits) private static byte
readByte
(boolean[] rawbits, int startIndex) Reads a code of length 8 in an array of bits, padding with zerosprivate static int
readCode
(boolean[] rawbits, int startIndex, int length) Reads a code of given length and at given index in an array of bitsprivate static int
totalBitsInLayer
(int layers, boolean compact)
-
Field Details
-
UPPER_TABLE
-
LOWER_TABLE
-
MIXED_TABLE
-
PUNCT_TABLE
-
DIGIT_TABLE
-
DEFAULT_ENCODING
-
ddata
-
-
Constructor Details
-
Decoder
public Decoder()
-
-
Method Details
-
decode
- Throws:
FormatException
-
highLevelDecode
- Throws:
FormatException
-
getEncodedData
Gets the string encoded in the aztec code bits- Returns:
- the decoded string
- Throws:
FormatException
-
getTable
gets the table corresponding to the char passed -
getCharacter
Gets the character (or string) corresponding to the passed code in the given table- Parameters:
table
- the table usedcode
- the code of the character
-
correctBits
Performs RS error correction on an array of bits.
- Returns:
- the corrected array
- Throws:
FormatException
- if the input contains too many errors
-
extractBits
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)
-