\r
package com.google.zxing.qrcode.decoder;\r
\r
-import com.google.zxing.ReaderException;\r
+import com.google.zxing.FormatException;\r
import com.google.zxing.common.BitMatrix;\r
\r
/**\r
\r
/**\r
* @param bitMatrix {@link BitMatrix} to parse\r
- * @throws ReaderException if dimension is not >= 21 and 1 mod 4\r
+ * @throws FormatException if dimension is not >= 21 and 1 mod 4\r
*/\r
- BitMatrixParser(BitMatrix bitMatrix) throws ReaderException {\r
+ BitMatrixParser(BitMatrix bitMatrix) throws FormatException {\r
int dimension = bitMatrix.getDimension();\r
if (dimension < 21 || (dimension & 0x03) != 1) {\r
- throw ReaderException.getInstance();\r
+ throw FormatException.getFormatInstance();\r
}\r
this.bitMatrix = bitMatrix;\r
}\r
* <p>Reads format information from one of its two locations within the QR Code.</p>\r
*\r
* @return {@link FormatInformation} encapsulating the QR Code's format info\r
- * @throws ReaderException if both format information locations cannot be parsed as\r
+ * @throws FormatException if both format information locations cannot be parsed as\r
* the valid encoding of format information\r
*/\r
- FormatInformation readFormatInformation() throws ReaderException {\r
+ FormatInformation readFormatInformation() throws FormatException {\r
\r
if (parsedFormatInfo != null) {\r
return parsedFormatInfo;\r
if (parsedFormatInfo != null) {\r
return parsedFormatInfo;\r
}\r
- throw ReaderException.getInstance();\r
+ throw FormatException.getFormatInstance();\r
}\r
\r
/**\r
* <p>Reads version information from one of its two locations within the QR Code.</p>\r
*\r
* @return {@link Version} encapsulating the QR Code's version\r
- * @throws ReaderException if both version information locations cannot be parsed as\r
+ * @throws FormatException if both version information locations cannot be parsed as\r
* the valid encoding of version information\r
*/\r
- Version readVersion() throws ReaderException {\r
+ Version readVersion() throws FormatException {\r
\r
if (parsedVersion != null) {\r
return parsedVersion;\r
if (parsedVersion != null && parsedVersion.getDimensionForVersion() == dimension) {\r
return parsedVersion;\r
}\r
- throw ReaderException.getInstance();\r
+ throw FormatException.getFormatInstance();\r
}\r
\r
private int copyBit(int i, int j, int versionBits) {\r
* QR Code.</p>\r
*\r
* @return bytes encoded within the QR Code\r
- * @throws ReaderException if the exact number of bytes expected is not read\r
+ * @throws FormatException if the exact number of bytes expected is not read\r
*/\r
- byte[] readCodewords() throws ReaderException {\r
+ byte[] readCodewords() throws FormatException {\r
\r
FormatInformation formatInfo = readFormatInformation();\r
Version version = readVersion();\r
readingUp ^= true; // readingUp = !readingUp; // switch directions\r
}\r
if (resultOffset != version.getTotalCodewords()) {\r
- throw ReaderException.getInstance();\r
+ throw FormatException.getFormatInstance();\r
}\r
return result;\r
}\r