Package com.google.zxing.oned
Class UPCAReader
java.lang.Object
com.google.zxing.oned.OneDReader
com.google.zxing.oned.UPCEANReader
com.google.zxing.oned.UPCAReader
- All Implemented Interfaces:
- Reader
Implements decoding of the UPC-A format.
- Author:
- dswitkin@google.com (Daniel Switkin), Sean Owen
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptiondecode(BinaryBitmap image) Locates and decodes a barcode in some format within an image.decode(BinaryBitmap image, Map<DecodeHintType, ?> hints) Locates and decodes a barcode in some format within an image.protected 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) LikeUPCEANReader.decodeRow(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.OneDReaderpatternMatchVariance, recordPattern, recordPatternInReverse, reset
- 
Constructor Details- 
UPCAReaderpublic UPCAReader()
 
- 
- 
Method Details- 
decodeRowpublic Result decodeRow(int rowNumber, BitArray row, int[] startGuardRange, Map<DecodeHintType, ?> hints) throws NotFoundException, FormatException, ChecksumExceptionDescription copied from class:UPCEANReaderLike UPCEANReader.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.- Overrides:
- decodeRowin class- UPCEANReader
- 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
- FormatException- if a potential barcode is found but format is invalid
- ChecksumException- if a potential barcode is found but does not pass its checksum
 
- 
decodeRowpublic Result decodeRow(int rowNumber, BitArray row, Map<DecodeHintType, ?> hints) throws NotFoundException, FormatException, ChecksumExceptionDescription copied from class:OneDReaderAttempts to decode a one-dimensional barcode format given a single row of an image. - Overrides:
- decodeRowin class- UPCEANReader
- 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
- FormatException- if a potential barcode is found but format is invalid
- ChecksumException- if a potential barcode is found but does not pass its checksum
 
- 
decodeDescription copied from interface:ReaderLocates and decodes a barcode in some format within an image.- Specified by:
- decodein interface- Reader
- Overrides:
- decodein class- OneDReader
- Parameters:
- image- image of barcode to decode
- Returns:
- String which the barcode encodes
- Throws:
- NotFoundException- if no potential barcode is found
- FormatException- if a potential barcode is found but format is invalid
 
- 
decodepublic Result decode(BinaryBitmap image, Map<DecodeHintType, ?> hints) throws NotFoundException, FormatExceptionDescription copied from interface:ReaderLocates and decodes a barcode in some format within an image. This method also accepts hints, each possibly associated to some data, which may help the implementation decode.- Specified by:
- decodein interface- Reader
- Overrides:
- decodein class- OneDReader
- Parameters:
- image- image of barcode to decode
- hints- passed as a- Mapfrom- DecodeHintTypeto arbitrary data. The meaning of the data depends upon the hint type. The implementation may or may not do anything with these hints.
- Returns:
- String which the barcode encodes
- Throws:
- NotFoundException- if no potential barcode is found
- FormatException- if a potential barcode is found but format is invalid
 
- 
decodeMiddleprotected int decodeMiddle(BitArray row, int[] startRange, StringBuilder resultString) 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 class- UPCEANReader
- 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
 
 
-