Package com.google.zxing.oned
Class UPCEReader
- java.lang.Object
-
- com.google.zxing.oned.OneDReader
-
- com.google.zxing.oned.UPCEANReader
-
- com.google.zxing.oned.UPCEReader
-
- All Implemented Interfaces:
Reader
public final class UPCEReader extends UPCEANReader
Implements decoding of the UPC-E format.
This is a great reference for UPC-E information.
-
-
Field Summary
Fields Modifier and Type Field Description private int[]decodeMiddleCountersprivate static int[]MIDDLE_END_PATTERNThe pattern that marks the middle, and end, of a UPC-E pattern.(package private) static int[][]NUMSYS_AND_CHECK_DIGIT_PATTERNSSeeUPCEANReader.L_AND_G_PATTERNS; these values similarly represent patterns of even-odd parity encodings of digits that imply both the number system (0 or 1) used, and the check digit.-
Fields inherited from class com.google.zxing.oned.UPCEANReader
END_PATTERN, L_AND_G_PATTERNS, L_PATTERNS, MIDDLE_PATTERN, START_END_PATTERN
-
-
Constructor Summary
Constructors Constructor Description UPCEReader()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleancheckChecksum(java.lang.String s)static java.lang.StringconvertUPCEtoUPCA(java.lang.String upce)Expands a UPC-E value back into its full, equivalent UPC-A code value.protected int[]decodeEnd(BitArray row, int endStart)protected intdecodeMiddle(BitArray row, int[] startRange, java.lang.StringBuilder result)Subclasses override this to decode the portion of a barcode between the start and end guard patterns.private static voiddetermineNumSysAndCheckDigit(java.lang.StringBuilder resultString, int lgPatternFound)(package private) BarcodeFormatgetBarcodeFormat()Get the format of this decoder.-
Methods inherited from class com.google.zxing.oned.UPCEANReader
checkStandardUPCEANChecksum, decodeDigit, decodeRow, decodeRow, findGuardPattern, findStartGuardPattern, getStandardUPCEANChecksum
-
Methods inherited from class com.google.zxing.oned.OneDReader
decode, decode, patternMatchVariance, recordPattern, recordPatternInReverse, reset
-
-
-
-
Field Detail
-
MIDDLE_END_PATTERN
private static final int[] MIDDLE_END_PATTERN
The pattern that marks the middle, and end, of a UPC-E pattern. There is no "second half" to a UPC-E barcode.
-
NUMSYS_AND_CHECK_DIGIT_PATTERNS
static final int[][] NUMSYS_AND_CHECK_DIGIT_PATTERNS
SeeUPCEANReader.L_AND_G_PATTERNS; these values similarly represent patterns of even-odd parity encodings of digits that imply both the number system (0 or 1) used, and the check digit.
-
decodeMiddleCounters
private final int[] decodeMiddleCounters
-
-
Method Detail
-
decodeMiddle
protected int decodeMiddle(BitArray row, int[] startRange, java.lang.StringBuilder result) throws NotFoundException
Description copied from class:UPCEANReaderSubclasses override this to decode the portion of a barcode between the start and end guard patterns.- Specified by:
decodeMiddlein classUPCEANReader- Parameters:
row- row of black/white values to searchstartRange- start/end offset of start guard patternresult-StringBuilderto append decoded chars to- Returns:
- horizontal offset of first pixel after the "middle" that was decoded
- Throws:
NotFoundException- if decoding could not complete successfully
-
decodeEnd
protected int[] decodeEnd(BitArray row, int endStart) throws NotFoundException
- Overrides:
decodeEndin classUPCEANReader- Throws:
NotFoundException
-
checkChecksum
protected boolean checkChecksum(java.lang.String s) throws FormatException- Overrides:
checkChecksumin classUPCEANReader- Parameters:
s- string of digits to check- Returns:
UPCEANReader.checkStandardUPCEANChecksum(CharSequence)- Throws:
FormatException- if the string does not contain only digits
-
determineNumSysAndCheckDigit
private static void determineNumSysAndCheckDigit(java.lang.StringBuilder resultString, int lgPatternFound) throws NotFoundException- Throws:
NotFoundException
-
getBarcodeFormat
BarcodeFormat getBarcodeFormat()
Description copied from class:UPCEANReaderGet the format of this decoder.- Specified by:
getBarcodeFormatin classUPCEANReader- Returns:
- The 1D format.
-
convertUPCEtoUPCA
public static java.lang.String convertUPCEtoUPCA(java.lang.String upce)
Expands a UPC-E value back into its full, equivalent UPC-A code value.- Parameters:
upce- UPC-E code as string of digits- Returns:
- equivalent UPC-A code as string of digits
-
-