Class UPCEANReader

    • Constructor Detail

      • UPCEANReader

        protected UPCEANReader()
    • Method Detail

      • 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.

        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:
        Result encapsulating 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
      • 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