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

public final class Versionextends Object
See ISO 18004:2006 Annex D
  • Field Details

    • VERSION_DECODE_INFO

      private static final int[] VERSION_DECODE_INFO
      See ISO 18004:2006 Annex D. Element i represents the raw version bits that specify version i + 7
    • VERSIONS

      private static final Version[] VERSIONS
      All the QR code versions.
    • versionNumber

      private final int versionNumber
      The number of this version.
    • alignmentPatternCenters

      private final int[] alignmentPatternCenters
      The centers of the alignment patterns.
    • ecBlocks

      private final Version.ECBlocks[] ecBlocks
      The error correction blocks, by level.
    • totalCodewords

      private final int totalCodewords
      The total number of codewords.
  • Constructor Details

    • Version

      private Version(int versionNumber, int[] alignmentPatternCenters, Version.ECBlocks... ecBlocks)
      Encapsulates the data for one symbol version.
      Parameters:
      versionNumber - the symbol version, from 1 through 40
      alignmentPatternCenters - alignment pattern coordinates
      ecBlocks - error correction blocks
  • Method Details

    • getVersionNumber

      public int getVersionNumber()
      Gets the version number.
      Returns:
      the version number
    • getAlignmentPatternCenters

      public int[] getAlignmentPatternCenters()
      Gets the alignment pattern centers.
      Returns:
      the alignment pattern centers
    • getTotalCodewords

      public int getTotalCodewords()
      Gets the total codewords.
      Returns:
      the total codewords
    • getDimensionForVersion

      public int getDimensionForVersion()
      Gets the dimension for the version.
      Returns:
      the dimension for version
    • getECBlocksForLevel

      public Version.ECBlocks getECBlocksForLevel(ErrorCorrectionLevel ecLevel)
      Gets the EC blocks for the error correction level.
      Parameters:
      ecLevel - the error correction level whose block layout to look up
      Returns:
      the e c blocks for level
    • getProvisionalVersionForDimension

      public static Version getProvisionalVersionForDimension(int dimension) throws FormatException

      Deduces version information purely from QR Code dimensions.

      Parameters:
      dimension - dimension in modules
      Returns:
      Version for a QR Code of that dimension
      Throws:
      FormatException - if dimension is not 1 mod 4
    • getVersionForNumber

      public static Version getVersionForNumber(int versionNumber)
      Gets the version for the version number.
      Parameters:
      versionNumber - the symbol version to look up, from 1 through 40
      Returns:
      the version for number
    • decodeVersionInformation

      static Version decodeVersionInformation(int versionBits)
      Decodes the version information from the raw version bits.
      Parameters:
      versionBits - raw version bits
      Returns:
      the version they encode, or null if none is within 3 bits of them
    • buildFunctionPattern

      BitMatrix buildFunctionPattern()
      See ISO 18004:2006 Annex E
      Returns:
      a matrix of this version's dimension with the finder, separator, alignment, timing and version information patterns marked
    • toString

      public String toString()
      Return the symbol version number in decimal.
      Overrides:
      toString in class Object
    • buildVersions

      private static Version[] buildVersions()
      See ISO 18004:2006 6.5.1 Table 9
      Returns:
      the table of all QR code symbol versions, 1 through 40