java.lang.Object
com.google.zxing.qrcode.decoder.FormatInformation

final class FormatInformationextends Object

Encapsulates a QR Code's format information, including the data mask used and error correction level.

See DataMask
See Also:
  • Method Details

    • numBitsDiffering

      static int numBitsDiffering(int a, int b)
      Counts the bits that differ between the two format info bit patterns.
      Parameters:
      a - first of the two format info bit patterns to compare
      b - second of the two format info bit patterns to compare
      Returns:
      number of differing bits
    • decodeFormatInformation

      static FormatInformation decodeFormatInformation(int maskedFormatInfo1, int maskedFormatInfo2)
      to establish best match if doesn't seem to match any known pattern
      Parameters:
      maskedFormatInfo1 - format info indicator, with mask still applied
      maskedFormatInfo2 - second copy of same info; both are checked at the same time
      Returns:
      information about the format it specifies, or null
    • getErrorCorrectionLevel

      ErrorCorrectionLevel getErrorCorrectionLevel()
      Error correction level decoded from format info bits.
      Returns:
      the level selected by bits 3 and 4 of the format information
    • getDataMask

      byte getDataMask()
      Data mask reference decoded from format info bits.
      Returns:
      the 0-7 mask pattern reference taken from the bottom three bits
    • hashCode

      public int hashCode()
      Hash of the error correction level combined with the data mask.
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object o)
      True if the other object has the same error correction level and data mask.
      Overrides:
      equals in class Object