Class UPCEReader

  • All Implemented Interfaces:
    Reader

    public final class UPCEReader
    extends UPCEANReader

    Implements decoding of the UPC-E format.

    This is a great reference for UPC-E information.

    • Field Detail

      • MIDDLE_END_PATTERN

        private static final int[] MIDDLE_END_PATTERN
        The pattern that marks the middle, and end, of a UPC-E pattern. There is no "second half" to a UPC-E barcode.
      • NUMSYS_AND_CHECK_DIGIT_PATTERNS

        static final int[][] NUMSYS_AND_CHECK_DIGIT_PATTERNS
        See UPCEANReader.L_AND_G_PATTERNS; these values similarly represent patterns of even-odd parity encodings of digits that imply both the number system (0 or 1) used, and the check digit.
      • decodeMiddleCounters

        private final int[] decodeMiddleCounters
    • Constructor Detail

      • UPCEReader

        public UPCEReader()
    • Method Detail

      • decodeMiddle

        protected int decodeMiddle​(BitArray row,
                                   int[] startRange,
                                   java.lang.StringBuilder result)
                            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
        result - 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
      • determineNumSysAndCheckDigit

        private static void determineNumSysAndCheckDigit​(java.lang.StringBuilder resultString,
                                                         int lgPatternFound)
                                                  throws NotFoundException
        Throws:
        NotFoundException
      • convertUPCEtoUPCA

        public static java.lang.String convertUPCEtoUPCA​(java.lang.String upce)
        Expands a UPC-E value back into its full, equivalent UPC-A code value.
        Parameters:
        upce - UPC-E code as string of digits
        Returns:
        equivalent UPC-A code as string of digits