Class EAN13Reader

  • All Implemented Interfaces:
    Reader

    public final class EAN13Reader
    extends UPCEANReader

    Implements decoding of the EAN-13 format.

    • Field Detail

      • FIRST_DIGIT_ENCODINGS

        static final int[] FIRST_DIGIT_ENCODINGS
      • decodeMiddleCounters

        private final int[] decodeMiddleCounters
    • Constructor Detail

      • EAN13Reader

        public EAN13Reader()
    • Method Detail

      • decodeMiddle

        protected int decodeMiddle​(BitArray row,
                                   int[] startRange,
                                   java.lang.StringBuilder resultString)
                            throws NotFoundException
        Description copied from class: UPCEANReader
        Subclasses override this to decode the portion of a barcode between the start and end guard patterns.
        Specified by:
        decodeMiddle in class UPCEANReader
        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
      • determineFirstDigit

        private static void determineFirstDigit​(java.lang.StringBuilder resultString,
                                                int lgPatternFound)
                                         throws NotFoundException
        Based on pattern of odd-even ('L' and 'G') patterns used to encoded the explicitly-encoded digits in a barcode, determines the implicitly encoded first digit and adds it to the result string.
        Parameters:
        resultString - string to insert decoded first digit into
        lgPatternFound - int whose bits indicates the pattern of odd/even L/G patterns used to encode digits
        Throws:
        NotFoundException - if first digit cannot be determined