Class DataBlock


  • final class DataBlock
    extends java.lang.Object

    Encapsulates a block of data within a Data Matrix Code. Data Matrix Codes may split their data into multiple blocks, each of which is a unit of data and error-correction codewords. Each is represented by an instance of this class.

    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private DataBlock​(int numDataCodewords, byte[] codewords)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) byte[] getCodewords()  
      (package private) static DataBlock[] getDataBlocks​(byte[] rawCodewords, Version version)
      When Data Matrix Codes use multiple data blocks, they actually interleave the bytes of each of them.
      (package private) int getNumDataCodewords()  
      • Methods inherited from class java.lang.Object

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

      • numDataCodewords

        private final int numDataCodewords
      • codewords

        private final byte[] codewords
    • Constructor Detail

      • DataBlock

        private DataBlock​(int numDataCodewords,
                          byte[] codewords)
    • Method Detail

      • getDataBlocks

        static DataBlock[] getDataBlocks​(byte[] rawCodewords,
                                         Version version)

        When Data Matrix Codes use multiple data blocks, they actually interleave the bytes of each of them. That is, the first byte of data block 1 to n is written, then the second bytes, and so on. This method will separate the data into original blocks.

        Parameters:
        rawCodewords - bytes as read directly from the Data Matrix Code
        version - version of the Data Matrix Code
        Returns:
        DataBlocks containing original bytes, "de-interleaved" from representation in the Data Matrix Code
      • getNumDataCodewords

        int getNumDataCodewords()
      • getCodewords

        byte[] getCodewords()