X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=core%2Fsrc%2Fcom%2Fgoogle%2Fzxing%2Foned%2FEAN13Reader.java;h=9c90e83ed21adffe58f294067acfa3448179745f;hb=15c31851811509205c843513211574f3b80db110;hp=d948aced0fbc128af630bdda8112bc5f912d06c5;hpb=1170ad08b19f495ae38daf72a816ac60e5606aae;p=zxing.git diff --git a/core/src/com/google/zxing/oned/EAN13Reader.java b/core/src/com/google/zxing/oned/EAN13Reader.java index d948aced..9c90e83e 100644 --- a/core/src/com/google/zxing/oned/EAN13Reader.java +++ b/core/src/com/google/zxing/oned/EAN13Reader.java @@ -16,8 +16,8 @@ package com.google.zxing.oned; -import com.google.zxing.ReaderException; import com.google.zxing.BarcodeFormat; +import com.google.zxing.NotFoundException; import com.google.zxing.common.BitArray; /** @@ -27,7 +27,7 @@ import com.google.zxing.common.BitArray; * @author Sean Owen * @author alasdair@google.com (Alasdair Mackintosh) */ -public final class EAN13Reader extends AbstractUPCEANReader { +public final class EAN13Reader extends UPCEANReader { // For an EAN-13 barcode, the first digit is represented by the parities used // to encode the next six digits, according to the table below. For example, @@ -51,14 +51,14 @@ public final class EAN13Reader extends AbstractUPCEANReader { // Note that the encoding for '0' uses the same parity as a UPC barcode. Hence // a UPC barcode can be converted to an EAN-13 barcode by prepending a 0. // - // The encodong is represented by the following array, which is a bit pattern + // The encoding is represented by the following array, which is a bit pattern // using Odd = 0 and Even = 1. For example, 5 is represented by: // // Odd Even Even Odd Odd Even // in binary: // 0 1 1 0 0 1 == 0x19 // - private static final int[] FIRST_DIGIT_ENCODINGS = { + static final int[] FIRST_DIGIT_ENCODINGS = { 0x00, 0x0B, 0x0D, 0xE, 0x13, 0x19, 0x1C, 0x15, 0x16, 0x1A }; @@ -68,7 +68,8 @@ public final class EAN13Reader extends AbstractUPCEANReader { decodeMiddleCounters = new int[4]; } - protected int decodeMiddle(BitArray row, int[] startRange, StringBuffer resultString) throws ReaderException { + protected int decodeMiddle(BitArray row, int[] startRange, StringBuffer resultString) + throws NotFoundException { int[] counters = decodeMiddleCounters; counters[0] = 0; counters[1] = 0; @@ -111,22 +112,24 @@ public final class EAN13Reader extends AbstractUPCEANReader { } /** - * Based on pattern of odd-even ('L' and 'G') patterns used to encoded the explicitly-encoded digits - * in a barcode, determines the implicitly encoded first digit and adds it to the result string. + * Based on pattern of odd-even ('L' and 'G') patterns used to encoded the explicitly-encoded + * digits in a barcode, determines the implicitly encoded first digit and adds it to the + * result string. * * @param resultString string to insert decoded first digit into * @param lgPatternFound int whose bits indicates the pattern of odd/even L/G patterns used to - * encode digits - * @throws ReaderException if first digit cannot be determined + * encode digits + * @throws NotFoundException if first digit cannot be determined */ - private static void determineFirstDigit(StringBuffer resultString, int lgPatternFound) throws ReaderException { + private static void determineFirstDigit(StringBuffer resultString, int lgPatternFound) + throws NotFoundException { for (int d = 0; d < 10; d++) { if (lgPatternFound == FIRST_DIGIT_ENCODINGS[d]) { resultString.insert(0, (char) ('0' + d)); return; } } - throw ReaderException.getInstance(); + throw NotFoundException.getNotFoundInstance(); } -} \ No newline at end of file +}