Package com.google.zxing.qrcode.decoder
Class Decoder
java.lang.Object
com.google.zxing.qrcode.decoder.Decoder
The main class which implements QR Code decoding -- as opposed to locating and extracting the QR Code from an image.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate int
correctErrors
(byte[] codewordBytes, int numDataCodewords) Given data and error-correction codewords received, possibly corrupted by errors, attempts to correct the errors in-place using Reed-Solomon error correction.decode
(boolean[][] image) decode
(boolean[][] image, Map<DecodeHintType, ?> hints) Convenience method that can decode a QR Code represented as a 2D array of booleans.decode
(BitMatrix bits, Map<DecodeHintType, ?> hints) Decodes a QR Code represented as aBitMatrix
.private DecoderResult
decode
(BitMatrixParser parser, Map<DecodeHintType, ?> hints)
-
Field Details
-
rsDecoder
-
-
Constructor Details
-
Decoder
public Decoder()
-
-
Method Details
-
decode
- Throws:
ChecksumException
FormatException
-
decode
public DecoderResult decode(boolean[][] image, Map<DecodeHintType, ?> hints) throws ChecksumException, FormatExceptionConvenience method that can decode a QR Code represented as a 2D array of booleans. "true" is taken to mean a black module.
- Parameters:
image
- booleans representing white/black QR Code moduleshints
- decoding hints that should be used to influence decoding- Returns:
- text and bytes encoded within the QR Code
- Throws:
FormatException
- if the QR Code cannot be decodedChecksumException
- if error correction fails
-
decode
- Throws:
ChecksumException
FormatException
-
decode
public DecoderResult decode(BitMatrix bits, Map<DecodeHintType, ?> hints) throws FormatException, ChecksumExceptionDecodes a QR Code represented as a
BitMatrix
. A 1 or "true" is taken to mean a black module.- Parameters:
bits
- booleans representing white/black QR Code moduleshints
- decoding hints that should be used to influence decoding- Returns:
- text and bytes encoded within the QR Code
- Throws:
FormatException
- if the QR Code cannot be decodedChecksumException
- if error correction fails
-
decode
private DecoderResult decode(BitMatrixParser parser, Map<DecodeHintType, ?> hints) throws FormatException, ChecksumException- Throws:
FormatException
ChecksumException
-
correctErrors
Given data and error-correction codewords received, possibly corrupted by errors, attempts to correct the errors in-place using Reed-Solomon error correction.
- Parameters:
codewordBytes
- data and error correction codewordsnumDataCodewords
- number of codewords that are data bytes- Returns:
- the number of errors corrected
- Throws:
ChecksumException
- if error correction fails
-