Class BitMatrixParser
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate BitMatrixextractDataRegion(BitMatrix bitMatrix) Extracts the data region from aBitMatrixthat contains alignment patterns.(package private) Version(package private) byte[]Reads the bits in theBitMatrixrepresenting the mapping matrix (No alignment patterns) in the correct order in order to reconstitute the codewords bytes contained within the Data Matrix Code.private intreadCorner1(int numRows, int numColumns) Reads the 8 bits of the special corner condition 1.private intreadCorner2(int numRows, int numColumns) Reads the 8 bits of the special corner condition 2.private intreadCorner3(int numRows, int numColumns) Reads the 8 bits of the special corner condition 3.private intreadCorner4(int numRows, int numColumns) Reads the 8 bits of the special corner condition 4.private booleanreadModule(int row, int column, int numRows, int numColumns) Reads a bit of the mapping matrix accounting for boundary wrapping.private intreadUtah(int row, int column, int numRows, int numColumns) Reads the 8 bits of the standard Utah-shaped pattern.private static VersionreadVersion(BitMatrix bitMatrix) Creates the version object based on the dimension of the original bit matrix from the datamatrix code.
-
Field Details
-
mappingBitMatrix
-
readMappingMatrix
-
version
-
-
Constructor Details
-
BitMatrixParser
BitMatrixParser(BitMatrix bitMatrix) throws FormatException - Parameters:
bitMatrix-BitMatrixto parse- Throws:
FormatException- if dimension is invalid input: '<' 8 or > 144 or not 0 mod 2
-
-
Method Details
-
getVersion
Version getVersion() -
readVersion
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
- Parameters:
bitMatrix- OriginalBitMatrixincluding alignment patterns- Returns:
Versionencapsulating the Data Matrix Code's "version"- Throws:
FormatException- if the dimensions of the mapping matrix are not valid Data Matrix dimensions.
-
readCodewords
Reads the bits in the
BitMatrixrepresenting the mapping matrix (No alignment patterns) in the correct order in order to reconstitute the codewords bytes contained within the Data Matrix Code.- Returns:
- bytes encoded within the Data Matrix Code
- Throws:
FormatException- if the exact number of bytes expected is not read
-
readModule
private boolean readModule(int row, int column, int numRows, int numColumns) Reads a bit of the mapping matrix accounting for boundary wrapping.
- Parameters:
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 matrix- Returns:
- value of the given bit in the mapping matrix
-
readUtah
private 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
- Parameters:
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 matrix- Returns:
- byte from the utah shape
-
readCorner1
private int readCorner1(int numRows, int numColumns) Reads the 8 bits of the special corner condition 1.
See ISO 16022:2006, Figure F.3
- Parameters:
numRows- Number of rows in the mapping matrixnumColumns- Number of columns in the mapping matrix- Returns:
- byte from the Corner condition 1
-
readCorner2
private int readCorner2(int numRows, int numColumns) Reads the 8 bits of the special corner condition 2.
See ISO 16022:2006, Figure F.4
- Parameters:
numRows- Number of rows in the mapping matrixnumColumns- Number of columns in the mapping matrix- Returns:
- byte from the Corner condition 2
-
readCorner3
private int readCorner3(int numRows, int numColumns) Reads the 8 bits of the special corner condition 3.
See ISO 16022:2006, Figure F.5
- Parameters:
numRows- Number of rows in the mapping matrixnumColumns- Number of columns in the mapping matrix- Returns:
- byte from the Corner condition 3
-
readCorner4
private int readCorner4(int numRows, int numColumns) Reads the 8 bits of the special corner condition 4.
See ISO 16022:2006, Figure F.6
- Parameters:
numRows- Number of rows in the mapping matrixnumColumns- Number of columns in the mapping matrix- Returns:
- byte from the Corner condition 4
-
extractDataRegion
-