Package com.google.zxing.aztec.decoder
Class Decoder
- java.lang.Object
-
- com.google.zxing.aztec.decoder.Decoder
-
public final class Decoder extends java.lang.ObjectThe main class which implements Aztec Code decoding -- as opposed to locating and extracting the Aztec Code from an image.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classDecoder.CorrectedBitsResultprivate static classDecoder.Table
-
Field Summary
Fields Modifier and Type Field Description private AztecDetectorResultddataprivate static java.nio.charset.CharsetDEFAULT_ENCODINGprivate static java.lang.String[]DIGIT_TABLEprivate static java.lang.String[]LOWER_TABLEprivate static java.lang.String[]MIXED_TABLEprivate static java.lang.String[]PUNCT_TABLEprivate static java.lang.String[]UPPER_TABLE
-
Constructor Summary
Constructors Constructor Description Decoder()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) static byte[]convertBoolArrayToByteArray(boolean[] boolArr)Packs a bit array into bytes, most significant bit firstprivate Decoder.CorrectedBitsResultcorrectBits(boolean[] rawbits)Performs RS error correction on an array of bits.DecoderResultdecode(AztecDetectorResult detectorResult)private boolean[]extractBits(BitMatrix matrix)Gets the array of bits from an Aztec Code matrixprivate static java.lang.StringgetCharacter(Decoder.Table table, int code)Gets the character (or string) corresponding to the passed code in the given tableprivate static java.lang.StringgetEncodedData(boolean[] correctedBits)Gets the string encoded in the aztec code bitsprivate static Decoder.TablegetTable(char t)gets the table corresponding to the char passedstatic java.lang.StringhighLevelDecode(boolean[] correctedBits)private static bytereadByte(boolean[] rawbits, int startIndex)Reads a code of length 8 in an array of bits, padding with zerosprivate static intreadCode(boolean[] rawbits, int startIndex, int length)Reads a code of given length and at given index in an array of bitsprivate static inttotalBitsInLayer(int layers, boolean compact)
-
-
-
Field Detail
-
UPPER_TABLE
private static final java.lang.String[] UPPER_TABLE
-
LOWER_TABLE
private static final java.lang.String[] LOWER_TABLE
-
MIXED_TABLE
private static final java.lang.String[] MIXED_TABLE
-
PUNCT_TABLE
private static final java.lang.String[] PUNCT_TABLE
-
DIGIT_TABLE
private static final java.lang.String[] DIGIT_TABLE
-
DEFAULT_ENCODING
private static final java.nio.charset.Charset DEFAULT_ENCODING
-
ddata
private AztecDetectorResult ddata
-
-
Method Detail
-
decode
public DecoderResult decode(AztecDetectorResult detectorResult) throws FormatException
- Throws:
FormatException
-
highLevelDecode
public static java.lang.String highLevelDecode(boolean[] correctedBits) throws FormatException- Throws:
FormatException
-
getEncodedData
private static java.lang.String getEncodedData(boolean[] correctedBits) throws FormatExceptionGets 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 java.lang.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 usedcode- 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)
-
-