java.lang.Object
com.google.zxing.qrcode.encoder.QRCode
QR Code representation for encoding.
Field Summary
Modifier and TypeFieldDescriptionprivate ErrorCorrectionLevelThe error correction level chosen.private intThe data mask pattern chosen, -1 before it is picked.private ByteMatrixThe finished symbol, null before it is built.private ModeThe encoding mode the data was encoded with.static final intNumber of mask patterns defined by the QR Code model.private VersionThe symbol size chosen.Constructor Summary
ConstructorsMethod Summary
Modifier and TypeMethodDescriptionReturn the error correction level.intReturn the index of the mask applied to the symbol.Return the encoded module matrix.getMode()Return the encoding mode.Return the symbol version.static booleanisValidMaskPattern(int maskPattern) Test whether a mask index is one of the eight the model defines.voidsetECLevel(ErrorCorrectionLevel value) Record the error correction level.voidsetMaskPattern(int value) Record the index of the mask to apply.voidsetMatrix(ByteMatrix value) Record the encoded module matrix.voidRecord the encoding mode.voidsetVersion(Version version) Record the symbol version.toString()Render the mode, correction level, version, mask and matrix as text.
Field Details
NUM_MASK_PATTERNS
public static final int NUM_MASK_PATTERNSNumber of mask patterns defined by the QR Code model.- See Also:
mode
The encoding mode the data was encoded with.ecLevel
The error correction level chosen.version
The symbol size chosen.maskPattern
private int maskPatternThe data mask pattern chosen, -1 before it is picked.matrix
The finished symbol, null before it is built.
Constructor Details
QRCode
public QRCode()Construct an empty QR Code, with no mask pattern selected yet.
Method Details
getMode
Return the encoding mode.- Returns:
- the encoding mode, null until setMode() has been called
getECLevel
getVersion
Return the symbol version.- Returns:
- the version, null until setVersion() has been called
getMaskPattern
public int getMaskPattern()Return the index of the mask applied to the symbol.- Returns:
- the mask pattern
getMatrix
Return the encoded module matrix.- Returns:
- the matrix, null until setMatrix() has been called
toString
setMode
Record the encoding mode.- Parameters:
value- the encoding mode for the data being encoded
setECLevel
Record the error correction level.- Parameters:
value- the error correction level to encode the symbol with
setVersion
Record the symbol version.- Parameters:
version- the symbol version, which fixes the matrix size
setMaskPattern
public void setMaskPattern(int value) Record the index of the mask to apply.- Parameters:
value- the index of the mask to apply, 0 to NUM_MASK_PATTERNS - 1
setMatrix
Record the encoded module matrix.- Parameters:
value- the encoded module matrix to emit
isValidMaskPattern
public static boolean isValidMaskPattern(int maskPattern) Test whether a mask index is one of the eight the model defines.- Parameters:
maskPattern- the mask index to test, in range only from 0 to NUM_MASK_PATTERNS - 1- Returns:
- whether valid mask pattern