Package com.google.zxing.oned
Class CodaBarReader
- java.lang.Object
-
- com.google.zxing.oned.OneDReader
-
- com.google.zxing.oned.CodaBarReader
-
- All Implemented Interfaces:
Reader
public final class CodaBarReader extends OneDReader
Decodes Codabar barcodes.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static char[]
ALPHABET
private static java.lang.String
ALPHABET_STRING
(package private) static int[]
CHARACTER_ENCODINGS
These represent the encodings of characters, as patterns of wide and narrow bars.private int
counterLength
private int[]
counters
private java.lang.StringBuilder
decodeRowResult
private static float
MAX_ACCEPTABLE
private static int
MIN_CHARACTER_LENGTH
private static float
PADDING
private static char[]
STARTEND_ENCODING
-
Constructor Summary
Constructors Constructor Description CodaBarReader()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) static boolean
arrayContains(char[] array, char key)
private void
counterAppend(int e)
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.private int
findStartPattern()
private void
setCounters(BitArray row)
Records the size of all runs of white and black pixels, starting with white.private int
toNarrowWidePattern(int position)
private void
validatePattern(int start)
-
Methods inherited from class com.google.zxing.oned.OneDReader
decode, decode, patternMatchVariance, recordPattern, recordPatternInReverse, reset
-
-
-
-
Field Detail
-
MAX_ACCEPTABLE
private static final float MAX_ACCEPTABLE
- See Also:
- Constant Field Values
-
PADDING
private static final float PADDING
- See Also:
- Constant Field Values
-
ALPHABET_STRING
private static final java.lang.String ALPHABET_STRING
- See Also:
- Constant Field Values
-
ALPHABET
static final char[] ALPHABET
-
CHARACTER_ENCODINGS
static final int[] CHARACTER_ENCODINGS
These represent the encodings of characters, as patterns of wide and narrow bars. The 7 least-significant bits of each int correspond to the pattern of wide and narrow, with 1s representing "wide" and 0s representing narrow.
-
MIN_CHARACTER_LENGTH
private static final int MIN_CHARACTER_LENGTH
- See Also:
- Constant Field Values
-
STARTEND_ENCODING
private static final char[] STARTEND_ENCODING
-
decodeRowResult
private final java.lang.StringBuilder decodeRowResult
-
counters
private int[] counters
-
counterLength
private int counterLength
-
-
Method Detail
-
decodeRow
public Result decodeRow(int rowNumber, BitArray row, java.util.Map<DecodeHintType,?> hints) throws NotFoundException
Description copied from class:OneDReader
Attempts to decode a one-dimensional barcode format given a single row of an image.
- Specified by:
decodeRow
in classOneDReader
- Parameters:
rowNumber
- row number from top of the rowrow
- the black/white pixel data of the rowhints
- decode hints- Returns:
Result
containing encoded string and start/end of barcode- Throws:
NotFoundException
- if no potential barcode is found
-
validatePattern
private void validatePattern(int start) throws NotFoundException
- Throws:
NotFoundException
-
setCounters
private void setCounters(BitArray row) throws NotFoundException
Records the size of all runs of white and black pixels, starting with white. This is just like recordPattern, except it records all the counters, and uses our builtin "counters" member for storage.- Parameters:
row
- row to count from- Throws:
NotFoundException
-
counterAppend
private void counterAppend(int e)
-
findStartPattern
private int findStartPattern() throws NotFoundException
- Throws:
NotFoundException
-
arrayContains
static boolean arrayContains(char[] array, char key)
-
toNarrowWidePattern
private int toNarrowWidePattern(int position)
-
-