Package com.google.zxing.oned
Class UPCEANReader
java.lang.Object
com.google.zxing.oned.OneDReader
com.google.zxing.oned.UPCEANReader
- All Implemented Interfaces:
- Reader
- Direct Known Subclasses:
- EAN13Reader,- EAN8Reader,- UPCAReader,- UPCEReader
Encapsulates functionality and implementation that is common to UPC and EAN families of one-dimensional barcodes.
- Author:
- dswitkin@google.com (Daniel Switkin), Sean Owen, alasdair@google.com (Alasdair Mackintosh)
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected abstract intdecodeMiddle(BitArray row, int[] startRange, StringBuilder resultString) Subclasses override this to decode the portion of a barcode between the start and end guard patterns.decodeRow(int rowNumber, BitArray row, int[] startGuardRange, Map<DecodeHintType, ?> hints) LikedecodeRow(int, BitArray, Map), but allows caller to inform method about where the UPC/EAN start pattern is found.decodeRow(int rowNumber, BitArray row, Map<DecodeHintType, ?> hints) Attempts to decode a one-dimensional barcode format given a single row of an image.Methods inherited from class com.google.zxing.oned.OneDReaderdecode, decode, patternMatchVariance, recordPattern, recordPatternInReverse, reset
- 
Constructor Details- 
UPCEANReaderprotected UPCEANReader()
 
- 
- 
Method Details- 
decodeRowpublic Result decodeRow(int rowNumber, BitArray row, Map<DecodeHintType, ?> hints) throws NotFoundException, ChecksumException, FormatExceptionDescription copied from class:OneDReaderAttempts to decode a one-dimensional barcode format given a single row of an image. - Specified by:
- decodeRowin class- OneDReader
- Parameters:
- rowNumber- row number from top of the row
- row- the black/white pixel data of the row
- hints- decode hints
- Returns:
- Resultcontaining encoded string and start/end of barcode
- Throws:
- 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
 
- 
decodeRowpublic Result decodeRow(int rowNumber, BitArray row, int[] startGuardRange, Map<DecodeHintType, ?> hints) throws NotFoundException, ChecksumException, FormatExceptionLike decodeRow(int, BitArray, 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.- Parameters:
- 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
- Returns:
- Resultencapsulating the result of decoding a barcode in the row
- Throws:
- 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
 
- 
decodeMiddleprotected abstract int decodeMiddle(BitArray row, int[] startRange, StringBuilder resultString) throws NotFoundException Subclasses override this to decode the portion of a barcode between the start and end guard patterns.- Parameters:
- row- row of black/white values to search
- startRange- start/end offset of start guard pattern
- resultString-- 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
 
 
-