com.google.zxing.oned
Class UPCEANReader

java.lang.Object
  extended by com.google.zxing.oned.OneDReader
      extended by com.google.zxing.oned.UPCEANReader
All Implemented Interfaces:
Reader
Direct Known Subclasses:
EAN13Reader, EAN8Reader, UPCAReader, UPCEReader

public abstract class UPCEANReader
extends OneDReader

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)

Field Summary
 
Fields inherited from class com.google.zxing.oned.OneDReader
INTEGER_MATH_SHIFT, PATTERN_MATCH_RESULT_SCALE_FACTOR
 
Constructor Summary
protected UPCEANReader()
           
 
Method Summary
protected abstract  int decodeMiddle(BitArray row, int[] startRange, java.lang.StringBuilder resultString)
          Subclasses override this to decode the portion of a barcode between the start and end guard patterns.
 Result decodeRow(int rowNumber, BitArray row, int[] startGuardRange, java.util.Map<DecodeHintType,?> hints)
          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 row, java.util.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.OneDReader
decode, decode, patternMatchVariance, recordPattern, recordPatternInReverse, reset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UPCEANReader

protected UPCEANReader()
Method Detail

decodeRow

public Result decodeRow(int rowNumber,
                        BitArray row,
                        java.util.Map<DecodeHintType,?> hints)
                 throws NotFoundException,
                        ChecksumException,
                        FormatException
Description copied from class: OneDReader

Attempts to decode a one-dimensional barcode format given a single row of an image.

Specified by:
decodeRow in class OneDReader
Parameters:
rowNumber - row number from top of the row
row - the black/white pixel data of the row
hints - decode hints
Returns:
Result containing encoded string and start/end of barcode
Throws:
NotFoundException - if an error occurs or barcode cannot be found
ChecksumException
FormatException

decodeRow

public Result decodeRow(int rowNumber,
                        BitArray row,
                        int[] startGuardRange,
                        java.util.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.

Throws:
NotFoundException
ChecksumException
FormatException

decodeMiddle

protected abstract int decodeMiddle(BitArray row,
                                    int[] startRange,
                                    java.lang.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 - 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