Class BitMatrixParser

java.lang.Object
com.google.zxing.datamatrix.decoder.BitMatrixParser

final class BitMatrixParser extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final BitMatrix
     
    private final BitMatrix
     
    private final Version
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    private BitMatrix
    Extracts the data region from a BitMatrix that contains alignment patterns.
    (package private) Version
     
    (package private) byte[]
    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
    Creates the version object based on the dimension of the original bit matrix from the datamatrix code.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • mappingBitMatrix

      private final BitMatrix mappingBitMatrix
    • readMappingMatrix

      private final BitMatrix readMappingMatrix
    • version

      private final Version version
  • Constructor Details

  • Method Details

    • getVersion

      Version getVersion()
    • readVersion

      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

      Parameters:
      bitMatrix - Original BitMatrix including alignment patterns
      Returns:
      Version encapsulating the Data Matrix Code's "version"
      Throws:
      FormatException - if the dimensions of the mapping matrix are not valid Data Matrix dimensions.
    • readCodewords

      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.

      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 matrix
      column - Column to read in the mapping matrix
      numRows - Number of rows in the mapping matrix
      numColumns - 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 pattern
      column - Current column in the mapping matrix, anchored at the 8th bit (LSB) of the pattern
      numRows - Number of rows in the mapping matrix
      numColumns - 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 matrix
      numColumns - 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 matrix
      numColumns - 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 matrix
      numColumns - 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 matrix
      numColumns - Number of columns in the mapping matrix
      Returns:
      byte from the Corner condition 4
    • extractDataRegion

      private BitMatrix extractDataRegion(BitMatrix bitMatrix)

      Extracts the data region from a BitMatrix that contains alignment patterns.

      Parameters:
      bitMatrix - Original BitMatrix with alignment patterns
      Returns:
      BitMatrix that has the alignment patterns removed