public final class Decoder
extends java.lang.Object
The main class which implements Aztec Code decoding -- as opposed to locating and extracting the Aztec Code from an image.
Modifier and Type | Class and Description |
---|---|
(package private) static class |
Decoder.CorrectedBitsResult |
private static class |
Decoder.Table |
Modifier and Type | Field and Description |
---|---|
private AztecDetectorResult |
ddata |
private static java.nio.charset.Charset |
DEFAULT_ENCODING |
private static java.lang.String[] |
DIGIT_TABLE |
private static java.lang.String[] |
LOWER_TABLE |
private static java.lang.String[] |
MIXED_TABLE |
private static java.lang.String[] |
PUNCT_TABLE |
private static java.lang.String[] |
UPPER_TABLE |
Constructor and Description |
---|
Decoder() |
Modifier and Type | Method and Description |
---|---|
(package private) static byte[] |
convertBoolArrayToByteArray(boolean[] boolArr)
Packs a bit array into bytes, most significant bit first
|
private Decoder.CorrectedBitsResult |
correctBits(boolean[] rawbits)
Performs RS error correction on an array of bits.
|
DecoderResult |
decode(AztecDetectorResult detectorResult) |
private boolean[] |
extractBits(BitMatrix matrix)
Gets the array of bits from an Aztec Code matrix
|
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
|
private static java.lang.String |
getEncodedData(boolean[] correctedBits)
Gets the string encoded in the aztec code bits
|
private static Decoder.Table |
getTable(char t)
gets the table corresponding to the char passed
|
static java.lang.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 zeros
|
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
|
private static int |
totalBitsInLayer(int layers,
boolean compact) |
private static final java.lang.String[] UPPER_TABLE
private static final java.lang.String[] LOWER_TABLE
private static final java.lang.String[] MIXED_TABLE
private static final java.lang.String[] PUNCT_TABLE
private static final java.lang.String[] DIGIT_TABLE
private static final java.nio.charset.Charset DEFAULT_ENCODING
private AztecDetectorResult ddata
public DecoderResult decode(AztecDetectorResult detectorResult) throws FormatException
FormatException
public static java.lang.String highLevelDecode(boolean[] correctedBits) throws FormatException
FormatException
private static java.lang.String getEncodedData(boolean[] correctedBits) throws FormatException
FormatException
private static Decoder.Table getTable(char t)
private static java.lang.String getCharacter(Decoder.Table table, int code)
table
- the table usedcode
- the code of the characterprivate Decoder.CorrectedBitsResult correctBits(boolean[] rawbits) throws FormatException
Performs RS error correction on an array of bits.
FormatException
- if the input contains too many errorsprivate boolean[] extractBits(BitMatrix matrix)
private static int readCode(boolean[] rawbits, int startIndex, int length)
private static byte readByte(boolean[] rawbits, int startIndex)
static byte[] convertBoolArrayToByteArray(boolean[] boolArr)
private static int totalBitsInLayer(int layers, boolean compact)