final class BitMatrixParser
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private BitMatrix |
bitMatrix |
private boolean |
mirror |
private FormatInformation |
parsedFormatInfo |
private Version |
parsedVersion |
Constructor and Description |
---|
BitMatrixParser(BitMatrix bitMatrix) |
Modifier and Type | Method and 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.
|
private final BitMatrix bitMatrix
private Version parsedVersion
private FormatInformation parsedFormatInfo
private boolean mirror
BitMatrixParser(BitMatrix bitMatrix) throws FormatException
bitMatrix
- BitMatrix
to parseFormatException
- if dimension is not >= 21 and 1 mod 4FormatInformation readFormatInformation() throws FormatException
Reads format information from one of its two locations within the QR Code.
FormatInformation
encapsulating the QR Code's format infoFormatException
- if both format information locations cannot be parsed as
the valid encoding of format informationVersion readVersion() throws FormatException
Reads version information from one of its two locations within the QR Code.
Version
encapsulating the QR Code's versionFormatException
- if both version information locations cannot be parsed as
the valid encoding of version informationprivate int copyBit(int i, int j, int versionBits)
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.
FormatException
- if the exact number of bytes expected is not readvoid remask()
void setMirror(boolean mirror)
readFormatInformation()
and the
readVersion()
. Before proceeding with readCodewords()
the
mirror()
method should be called.mirror
- Whether to read version and format information mirrored.void mirror()