public abstract class UPCEANReader extends OneDReader
Encapsulates functionality and implementation that is common to UPC and EAN families of one-dimensional barcodes.
| Modifier | Constructor and Description |
|---|---|
protected |
UPCEANReader()
|
| Modifier and Type | Method and Description |
|---|---|
protected abstract int |
decodeMiddle(BitArray
Subclasses override this to decode the portion of a barcode between the start and end guard patterns.
|
Result |
decodeRow(int rowNumber, BitArray
Like
decodeRow(int, BitArray, java.util.Map), but allows caller to inform method about where the UPC/EAN start pattern is found.
|
Result |
decodeRow(int rowNumber, BitArray
Attempts to decode a one-dimensional barcode format given a single row of an image.
|
decode, decode, patternMatchVariance, recordPattern, recordPatternInReverse, resetpublic ResultdecodeRow(int rowNumber, BitArray row, Map <DecodeHintType ,?> hints) throws NotFoundException , ChecksumException , FormatException
OneDReader
Attempts to decode a one-dimensional barcode format given a single row of an image.
decodeRow in class
OneDReader
rowNumber - row number from top of the row
row - the black/white pixel data of the row
hints - decode hints
Result containing encoded string and start/end of barcode
NotFoundException - if no potential barcode is found
ChecksumException - if a potential barcode is found but does not pass its checksum
FormatException - if a potential barcode is found but format is invalid
public ResultdecodeRow(int rowNumber, BitArray row, int[] startGuardRange, Map <DecodeHintType ,?> hints) throws NotFoundException , ChecksumException , FormatException
Like decodeRow(int, BitArray, java.util.Map), but allows caller to inform method about where the UPC/EAN start pattern is found. This allows this to be computed once and reused across many implementations.
rowNumber - row index into the image
row - encoding of the row of the barcode image
startGuardRange - start/end column where the opening start pattern was found
hints - optional hints that influence decoding
Result encapsulating the result of decoding a barcode in the row
NotFoundException - if no potential barcode is found
ChecksumException - if a potential barcode is found but does not pass its checksum
FormatException - if a potential barcode is found but format is invalid
protected abstract int decodeMiddle(BitArrayrow, int[] startRange, StringBuilder resultString) throws NotFoundException
row - row of black/white values to search
startRange - start/end offset of start guard pattern
resultString -
StringBuilder to append decoded chars to
NotFoundException - if decoding could not complete successfully