final class BitMatrixParser
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private BitMatrix |
mappingBitMatrix |
private BitMatrix |
readMappingMatrix |
private Version |
version |
Constructor and Description |
---|
BitMatrixParser(BitMatrix bitMatrix) |
Modifier and Type | Method and Description |
---|---|
private BitMatrix |
extractDataRegion(BitMatrix bitMatrix)
Extracts the data region from a
BitMatrix that contains
alignment patterns. |
(package private) Version |
getVersion() |
(package private) byte[] |
readCodewords()
Reads the bits in the
BitMatrix representing the mapping matrix (No alignment patterns)
in the correct order in order to reconstitute the codewords bytes contained within the
Data Matrix Code. |
private int |
readCorner1(int numRows,
int numColumns)
Reads the 8 bits of the special corner condition 1.
|
private int |
readCorner2(int numRows,
int numColumns)
Reads the 8 bits of the special corner condition 2.
|
private int |
readCorner3(int numRows,
int numColumns)
Reads the 8 bits of the special corner condition 3.
|
private int |
readCorner4(int numRows,
int numColumns)
Reads the 8 bits of the special corner condition 4.
|
private boolean |
readModule(int row,
int column,
int numRows,
int numColumns)
Reads a bit of the mapping matrix accounting for boundary wrapping.
|
private int |
readUtah(int row,
int column,
int numRows,
int numColumns)
Reads the 8 bits of the standard Utah-shaped pattern.
|
private static Version |
readVersion(BitMatrix bitMatrix)
Creates the version object based on the dimension of the original bit matrix from
the datamatrix code.
|
private final BitMatrix mappingBitMatrix
private final BitMatrix readMappingMatrix
private final Version version
BitMatrixParser(BitMatrix bitMatrix) throws FormatException
bitMatrix
- BitMatrix
to parseFormatException
- if dimension is < 8 or > 144 or not 0 mod 2Version getVersion()
private static Version readVersion(BitMatrix bitMatrix) throws FormatException
Creates the version object based on the dimension of the original bit matrix from the datamatrix code.
See ISO 16022:2006 Table 7 - ECC 200 symbol attributes
bitMatrix
- Original BitMatrix
including alignment patternsVersion
encapsulating the Data Matrix Code's "version"FormatException
- if the dimensions of the mapping matrix are not valid
Data Matrix dimensions.byte[] readCodewords() throws FormatException
Reads the bits in the BitMatrix
representing the mapping matrix (No alignment patterns)
in the correct order in order to reconstitute the codewords bytes contained within the
Data Matrix Code.
FormatException
- if the exact number of bytes expected is not readprivate boolean readModule(int row, int column, int numRows, int numColumns)
Reads a bit of the mapping matrix accounting for boundary wrapping.
row
- Row to read in the mapping matrixcolumn
- Column to read in the mapping matrixnumRows
- Number of rows in the mapping matrixnumColumns
- Number of columns in the mapping matrixprivate int readUtah(int row, int column, int numRows, int numColumns)
Reads the 8 bits of the standard Utah-shaped pattern.
See ISO 16022:2006, 5.8.1 Figure 6
row
- Current row in the mapping matrix, anchored at the 8th bit (LSB) of the patterncolumn
- Current column in the mapping matrix, anchored at the 8th bit (LSB) of the patternnumRows
- Number of rows in the mapping matrixnumColumns
- Number of columns in the mapping matrixprivate int readCorner1(int numRows, int numColumns)
Reads the 8 bits of the special corner condition 1.
See ISO 16022:2006, Figure F.3
numRows
- Number of rows in the mapping matrixnumColumns
- Number of columns in the mapping matrixprivate int readCorner2(int numRows, int numColumns)
Reads the 8 bits of the special corner condition 2.
See ISO 16022:2006, Figure F.4
numRows
- Number of rows in the mapping matrixnumColumns
- Number of columns in the mapping matrixprivate int readCorner3(int numRows, int numColumns)
Reads the 8 bits of the special corner condition 3.
See ISO 16022:2006, Figure F.5
numRows
- Number of rows in the mapping matrixnumColumns
- Number of columns in the mapping matrixprivate int readCorner4(int numRows, int numColumns)
Reads the 8 bits of the special corner condition 4.
See ISO 16022:2006, Figure F.6
numRows
- Number of rows in the mapping matrixnumColumns
- Number of columns in the mapping matrix