package com.google.zxing.oned;
-import com.google.zxing.ReaderException;
import com.google.zxing.BarcodeFormat;
+import com.google.zxing.ChecksumException;
+import com.google.zxing.FormatException;
+import com.google.zxing.NotFoundException;
import com.google.zxing.common.BitArray;
/**
* <p><a href="http://www.barcodeisland.com/upce.phtml">This</a> is a great reference for
* UPC-E information.</p>
*
- * @author srowen@google.com (Sean Owen)
+ * @author Sean Owen
*/
-public final class UPCEReader extends AbstractUPCEANReader {
+public final class UPCEReader extends UPCEANReader {
/**
* The pattern that marks the middle, and end, of a UPC-E pattern.
decodeMiddleCounters = new int[4];
}
- protected int decodeMiddle(BitArray row, int[] startRange, StringBuffer result) throws ReaderException {
+ protected int decodeMiddle(BitArray row, int[] startRange, StringBuffer result)
+ throws NotFoundException {
int[] counters = decodeMiddleCounters;
counters[0] = 0;
counters[1] = 0;
return rowOffset;
}
- protected int[] decodeEnd(BitArray row, int endStart) throws ReaderException {
+ protected int[] decodeEnd(BitArray row, int endStart) throws NotFoundException {
return findGuardPattern(row, endStart, true, MIDDLE_END_PATTERN);
}
- protected boolean checkChecksum(String s) throws ReaderException {
+ protected boolean checkChecksum(String s) throws FormatException, ChecksumException {
return super.checkChecksum(convertUPCEtoUPCA(s));
}
private static void determineNumSysAndCheckDigit(StringBuffer resultString, int lgPatternFound)
- throws ReaderException {
+ throws NotFoundException {
for (int numSys = 0; numSys <= 1; numSys++) {
for (int d = 0; d < 10; d++) {
}
}
}
- throw new ReaderException("Unable to determine number system and check digit");
+ throw NotFoundException.getNotFoundInstance();
}
BarcodeFormat getBarcodeFormat() {
- return BarcodeFormat.UPC_E;
+ return BarcodeFormat.UPC_E;
}
/**
return result.toString();
}
-}
\ No newline at end of file
+}