projects
/
zxing.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Tiny style bits
[zxing.git]
/
core
/
src
/
com
/
google
/
zxing
/
qrcode
/
decoder
/
Decoder.java
diff --git
a/core/src/com/google/zxing/qrcode/decoder/Decoder.java
b/core/src/com/google/zxing/qrcode/decoder/Decoder.java
index
6a576f8
..
22cdeb0
100644
(file)
--- a/
core/src/com/google/zxing/qrcode/decoder/Decoder.java
+++ b/
core/src/com/google/zxing/qrcode/decoder/Decoder.java
@@
-16,7
+16,9
@@
\r
package com.google.zxing.qrcode.decoder;
\r
\r
\r
package com.google.zxing.qrcode.decoder;
\r
\r
-import com.google.zxing.ReaderException;
\r
+import com.google.zxing.ChecksumException;
\r
+import com.google.zxing.FormatException;
\r
+import com.google.zxing.NotFoundException;
\r
import com.google.zxing.common.BitMatrix;
\r
import com.google.zxing.common.DecoderResult;
\r
import com.google.zxing.common.reedsolomon.GF256;
\r
import com.google.zxing.common.BitMatrix;
\r
import com.google.zxing.common.DecoderResult;
\r
import com.google.zxing.common.reedsolomon.GF256;
\r
@@
-39,7
+41,8
@@
public final class Decoder {
rsDecoder = new ReedSolomonDecoder(GF256.QR_CODE_FIELD);
\r
}
\r
\r
rsDecoder = new ReedSolomonDecoder(GF256.QR_CODE_FIELD);
\r
}
\r
\r
- public DecoderResult decode(boolean[][] image) throws ReaderException {
\r
+ public DecoderResult decode(boolean[][] image)
\r
+ throws ChecksumException, FormatException, NotFoundException {
\r
return decode(image, null);
\r
}
\r
\r
return decode(image, null);
\r
}
\r
\r
@@
-49,9
+52,12
@@
public final class Decoder {
*
\r
* @param image booleans representing white/black QR Code modules
\r
* @return text and bytes encoded within the QR Code
\r
*
\r
* @param image booleans representing white/black QR Code modules
\r
* @return text and bytes encoded within the QR Code
\r
- * @throws ReaderException if the QR Code cannot be decoded
\r
+ * @throws NotFoundException if the QR Code cannot be found
\r
+ * @throws FormatException if the QR Code cannot be decoded
\r
+ * @throws ChecksumException if error correction fails
\r
*/
\r
*/
\r
- public DecoderResult decode(boolean[][] image, Hashtable hints) throws ReaderException {
\r
+ public DecoderResult decode(boolean[][] image, Hashtable hints)
\r
+ throws ChecksumException, FormatException, NotFoundException {
\r
int dimension = image.length;
\r
BitMatrix bits = new BitMatrix(dimension);
\r
for (int i = 0; i < dimension; i++) {
\r
int dimension = image.length;
\r
BitMatrix bits = new BitMatrix(dimension);
\r
for (int i = 0; i < dimension; i++) {
\r
@@
-64,7
+70,7
@@
public final class Decoder {
return decode(bits, hints);
\r
}
\r
\r
return decode(bits, hints);
\r
}
\r
\r
- public DecoderResult decode(BitMatrix bits) throws
Reader
Exception {
\r
+ public DecoderResult decode(BitMatrix bits) throws
ChecksumException, FormatException, NotFound
Exception {
\r
return decode(bits, null);
\r
}
\r
\r
return decode(bits, null);
\r
}
\r
\r
@@
-73,9
+79,10
@@
public final class Decoder {
*
\r
* @param bits booleans representing white/black QR Code modules
\r
* @return text and bytes encoded within the QR Code
\r
*
\r
* @param bits booleans representing white/black QR Code modules
\r
* @return text and bytes encoded within the QR Code
\r
- * @throws ReaderException if the QR Code cannot be decoded
\r
+ * @throws FormatException if the QR Code cannot be decoded
\r
+ * @throws ChecksumException if error correction fails
\r
*/
\r
*/
\r
- public DecoderResult decode(BitMatrix bits, Hashtable hints) throws
Reader
Exception {
\r
+ public DecoderResult decode(BitMatrix bits, Hashtable hints) throws
FormatException, Checksum
Exception {
\r
\r
// Construct a parser and read version, error-correction level
\r
BitMatrixParser parser = new BitMatrixParser(bits);
\r
\r
// Construct a parser and read version, error-correction level
\r
BitMatrixParser parser = new BitMatrixParser(bits);
\r
@@
-116,9
+123,9
@@
public final class Decoder {
*
\r
* @param codewordBytes data and error correction codewords
\r
* @param numDataCodewords number of codewords that are data bytes
\r
*
\r
* @param codewordBytes data and error correction codewords
\r
* @param numDataCodewords number of codewords that are data bytes
\r
- * @throws
Reader
Exception if error correction fails
\r
+ * @throws
Checksum
Exception if error correction fails
\r
*/
\r
*/
\r
- private void correctErrors(byte[] codewordBytes, int numDataCodewords) throws
Reader
Exception {
\r
+ private void correctErrors(byte[] codewordBytes, int numDataCodewords) throws
Checksum
Exception {
\r
int numCodewords = codewordBytes.length;
\r
// First read into an array of ints
\r
int[] codewordsInts = new int[numCodewords];
\r
int numCodewords = codewordBytes.length;
\r
// First read into an array of ints
\r
int[] codewordsInts = new int[numCodewords];
\r
@@
-129,7
+136,7
@@
public final class Decoder {
try {
\r
rsDecoder.decode(codewordsInts, numECCodewords);
\r
} catch (ReedSolomonException rse) {
\r
try {
\r
rsDecoder.decode(codewordsInts, numECCodewords);
\r
} catch (ReedSolomonException rse) {
\r
- throw
ReaderException.get
Instance();
\r
+ throw
ChecksumException.getChecksum
Instance();
\r
}
\r
// Copy back into array of bytes -- only need to worry about the bytes that were data
\r
// We don't care about errors in the error-correction codewords
\r
}
\r
// Copy back into array of bytes -- only need to worry about the bytes that were data
\r
// We don't care about errors in the error-correction codewords
\r