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
Implements decoding of the UPC-E format.
This is a great reference for UPC-E information.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final int[]
private static final int[]
The pattern that marks the middle, and end, of a UPC-E pattern.(package private) static final int[][]
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.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 -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
static String
convertUPCEtoUPCA
(String upce) Expands a UPC-E value back into its full, equivalent UPC-A code value.protected int[]
protected int
decodeMiddle
(BitArray row, int[] startRange, StringBuilder result) Subclasses override this to decode the portion of a barcode between the start and end guard patterns.private static void
determineNumSysAndCheckDigit
(StringBuilder resultString, int lgPatternFound) (package private) BarcodeFormat
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 Details
-
MIDDLE_END_PATTERN
private static final int[] MIDDLE_END_PATTERNThe 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_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. -
decodeMiddleCounters
private final int[] decodeMiddleCounters
-
-
Constructor Details
-
UPCEReader
public UPCEReader()
-
-
Method Details
-
decodeMiddle
protected int decodeMiddle(BitArray row, int[] startRange, StringBuilder result) throws NotFoundException Description copied from class:UPCEANReader
Subclasses override this to decode the portion of a barcode between the start and end guard patterns.- Specified by:
decodeMiddle
in classUPCEANReader
- Parameters:
row
- row of black/white values to searchstartRange
- start/end offset of start guard patternresult
-StringBuilder
to 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
- Overrides:
decodeEnd
in classUPCEANReader
- Throws:
NotFoundException
-
checkChecksum
- Overrides:
checkChecksum
in 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(StringBuilder resultString, int lgPatternFound) throws NotFoundException - Throws:
NotFoundException
-
getBarcodeFormat
BarcodeFormat getBarcodeFormat()Description copied from class:UPCEANReader
Get the format of this decoder.- Specified by:
getBarcodeFormat
in classUPCEANReader
- Returns:
- The 1D format.
-
convertUPCEtoUPCA
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
-