Class BitMatrixParser


  • final class BitMatrixParser
    extends java.lang.Object
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private int copyBit​(int i, int j, int versionBits)  
      (package private) void mirror()
      Mirror the bit matrix in order to attempt a second reading.
      (package private) byte[] readCodewords()
      Reads the bits in the BitMatrix representing the finder pattern in the correct order in order to reconstruct the codewords bytes contained within the QR Code.
      (package private) FormatInformation readFormatInformation()
      Reads format information from one of its two locations within the QR Code.
      (package private) Version readVersion()
      Reads version information from one of its two locations within the QR Code.
      (package private) void remask()
      Revert the mask removal done while reading the code words.
      (package private) void setMirror​(boolean mirror)
      Prepare the parser for a mirrored operation.
      • Methods inherited from class java.lang.Object

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

      • bitMatrix

        private final BitMatrix bitMatrix
      • parsedVersion

        private Version parsedVersion
      • mirror

        private boolean mirror
    • Method Detail

      • readFormatInformation

        FormatInformation readFormatInformation()
                                         throws FormatException

        Reads format information from one of its two locations within the QR Code.

        Returns:
        FormatInformation encapsulating the QR Code's format info
        Throws:
        FormatException - if both format information locations cannot be parsed as the valid encoding of format information
      • readVersion

        Version readVersion()
                     throws FormatException

        Reads version information from one of its two locations within the QR Code.

        Returns:
        Version encapsulating the QR Code's version
        Throws:
        FormatException - if both version information locations cannot be parsed as the valid encoding of version information
      • copyBit

        private int copyBit​(int i,
                            int j,
                            int versionBits)
      • readCodewords

        byte[] readCodewords()
                      throws FormatException

        Reads the bits in the BitMatrix representing the finder pattern in the correct order in order to reconstruct the codewords bytes contained within the QR Code.

        Returns:
        bytes encoded within the QR Code
        Throws:
        FormatException - if the exact number of bytes expected is not read
      • remask

        void remask()
        Revert the mask removal done while reading the code words. The bit matrix should revert to its original state.
      • setMirror

        void setMirror​(boolean mirror)
        Prepare the parser for a mirrored operation. This flag has effect only on the readFormatInformation() and the readVersion(). Before proceeding with readCodewords() the mirror() method should be called.
        Parameters:
        mirror - Whether to read version and format information mirrored.
      • mirror

        void mirror()
        Mirror the bit matrix in order to attempt a second reading.