readCodewords() {
        const result = new Int8Array(this.version.getTotalCodewords());
        let resultOffset = 0;
        let row = 4;
        let column = 0;
        const numRows = this.mappingBitMatrix.getHeight();
        const numColumns = this.mappingBitMatrix.getWidth();
        let corner1Read = false;
        let corner2Read = false;
        let corner3Read = false;
        let corner4Read = false;
        // Read all of the codewords
        do {
            // Check the four corner cases
            if ((row === numRows) && (column === 0) && !corner1Read) {
                result[resultOffset++] = this.readCorner1(numRows, numColumns) & 0xff;
                row -= 2;
                column += 2;
                corner1Read = true;
            }
            else if ((row === numRows - 2) && (column === 0) && ((numColumns & 0x03) !== 0) && !corner2Read) {
                result[resultOffset++] = this.readCorner2(numRows, numColumns) & 0xff;
                row -= 2;
                column += 2;
                corner2Read = true;
            }
            else if ((row === numRows + 4) && (column === 2) && ((numColumns & 0x07) === 0) && !corner3Read) {
                result[resultOffset++] = this.readCorner3(numRows, numColumns) & 0xff;
                row -= 2;
                column += 2;
                corner3Read = true;
            }
            else if ((row === numRows - 2) && (column === 0) && ((numColumns & 0x07) === 4) && !corner4Read) {
                result[resultOffset++] = this.readCorner4(numRows, numColumns) & 0xff;
                row -= 2;
                column += 2;
                corner4Read = true;
            }
            else {
                // Sweep upward diagonally to the right
                do {
                    if ((row < numRows) && (column >= 0) && !this.readMappingMatrix.get(column, row)) {
                        result[resultOffset++] = this.readUtah(row, column, numRows, numColumns) & 0xff;
                    }
                    row -= 2;
                    column += 2;
                } while ((row >= 0) && (column < numColumns));
                row += 1;
                column += 3;
                // Sweep downward diagonally to the left
                do {
                    if ((row >= 0) && (column < numColumns) && !this.readMappingMatrix.get(column, row)) {
                        result[resultOffset++] = this.readUtah(row, column, numRows, numColumns) & 0xff;
                    }
                    row += 2;
                    column -= 2;
                } while ((row < numRows) && (column >= 0));
                row += 3;
                column += 1;
            }
        } while ((row < numRows) || (column < numColumns));
        if (resultOffset !== this.version.getTotalCodewords()) {
            throw new FormatException();
        }
        return result;
    }
/**
     * <p>Reads the bits in the {@link 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.</p>
     *
     * @return bytes encoded within the Data Matrix Code
     * @throws FormatException if the exact number of bytes expected is not read
     */
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.

@return bytes encoded within the Data Matrix Code
@throws FormatException if the exact number of bytes expected is not read
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 . @return bytes encoded within the Data Matrix Code @throws FormatException if the exact number of bytes expected is not read
readCodewords() {
        const result = new Int8Array(this.version.getTotalCodewords());
        let resultOffset = 0;
        let row = 4;
        let column = 0;
        const numRows = this.mappingBitMatrix.getHeight();
        const numColumns = this.mappingBitMatrix.getWidth();
        let corner1Read = false;
        let corner2Read = false;
        let corner3Read = false;
        let corner4Read = false;
        do {
            if ((row === numRows) && (column === 0) && !corner1Read) {
                result[resultOffset++] = this.readCorner1(numRows, numColumns) & 0xff;
                row -= 2;
                column += 2;
                corner1Read = true;
            }
            else if ((row === numRows - 2) && (column === 0) && ((numColumns & 0x03) !== 0) && !corner2Read) {
                result[resultOffset++] = this.readCorner2(numRows, numColumns) & 0xff;
                row -= 2;
                column += 2;
                corner2Read = true;
            }
            else if ((row === numRows + 4) && (column === 2) && ((numColumns & 0x07) === 0) && !corner3Read) {
                result[resultOffset++] = this.readCorner3(numRows, numColumns) & 0xff;
                row -= 2;
                column += 2;
                corner3Read = true;
            }
            else if ((row === numRows - 2) && (column === 0) && ((numColumns & 0x07) === 4) && !corner4Read) {
                result[resultOffset++] = this.readCorner4(numRows, numColumns) & 0xff;
                row -= 2;
                column += 2;
                corner4Read = true;
            }
            else {
                do {
                    if ((row < numRows) && (column >= 0) && !this.readMappingMatrix.get(column, row)) {
                        result[resultOffset++] = this.readUtah(row, column, numRows, numColumns) & 0xff;
                    }
                    row -= 2;
                    column += 2;
                } while ((row >= 0) && (column < numColumns));
                row += 1;
                column += 3;
                do {
                    if ((row >= 0) && (column < numColumns) && !this.readMappingMatrix.get(column, row)) {
                        result[resultOffset++] = this.readUtah(row, column, numRows, numColumns) & 0xff;
                    }
                    row += 2;
                    column -= 2;
                } while ((row < numRows) && (column >= 0));
                row += 3;
                column += 1;
            }
        } while ((row < numRows) || (column < numColumns));
        if (resultOffset !== this.version.getTotalCodewords()) {
            throw new FormatException();
        }
        return result;
    }
readCodewords ( ) { const result = new Int8Array ( this . version . getTotalCodewords ( ) ) ; let resultOffset = 0 ; let row = 4 ; let column = 0 ; const numRows = this . mappingBitMatrix . getHeight ( ) ; const numColumns = this . mappingBitMatrix . getWidth ( ) ; let corner1Read = false ; let corner2Read = false ; let corner3Read = false ; let corner4Read = false ; do { if ( ( row === numRows ) && ( column === 0 ) && ! corner1Read ) { result [ resultOffset ++ ] = this . readCorner1 ( numRows , numColumns ) & 0xff ; row -= 2 ; column += 2 ; corner1Read = true ; } else if ( ( row === numRows - 2 ) && ( column === 0 ) && ( ( numColumns & 0x03 ) !== 0 ) && ! corner2Read ) { result [ resultOffset ++ ] = this . readCorner2 ( numRows , numColumns ) & 0xff ; row -= 2 ; column += 2 ; corner2Read = true ; } else if ( ( row === numRows + 4 ) && ( column === 2 ) && ( ( numColumns & 0x07 ) === 0 ) && ! corner3Read ) { result [ resultOffset ++ ] = this . readCorner3 ( numRows , numColumns ) & 0xff ; row -= 2 ; column += 2 ; corner3Read = true ; } else if ( ( row === numRows - 2 ) && ( column === 0 ) && ( ( numColumns & 0x07 ) === 4 ) && ! corner4Read ) { result [ resultOffset ++ ] = this . readCorner4 ( numRows , numColumns ) & 0xff ; row -= 2 ; column += 2 ; corner4Read = true ; } else { do { if ( ( row < numRows ) && ( column >= 0 ) && ! this . readMappingMatrix . get ( column , row ) ) { result [ resultOffset ++ ] = this . readUtah ( row , column , numRows , numColumns ) & 0xff ; } row -= 2 ; column += 2 ; } while ( ( row >= 0 ) && ( column < numColumns ) ) ; row += 1 ; column += 3 ; do { if ( ( row >= 0 ) && ( column < numColumns ) && ! this . readMappingMatrix . get ( column , row ) ) { result [ resultOffset ++ ] = this . readUtah ( row , column , numRows , numColumns ) & 0xff ; } row += 2 ; column -= 2 ; } while ( ( row < numRows ) && ( column >= 0 ) ) ; row += 3 ; column += 1 ; } } while ( ( row < numRows ) || ( column < numColumns ) ) ; if ( resultOffset !== this . version . getTotalCodewords ( ) ) { throw new FormatException ( ) ; } return result ; }
<p>Reads the bits in the {@link 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.</p>
<p > Reads the bits in the { @link 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 . < / p >
// Read all of the codewords // Check the four corner cases // Sweep upward diagonally to the right // Sweep downward diagonally to the left