Class DefaultBarcodeDecoder

  • All Implemented Interfaces:
    BarcodeDecoder

    public class DefaultBarcodeDecoder
    extends Object
    implements BarcodeDecoder
    Default implementation of the BarcodeDecoder interface using the ZXing library.
    Author:
    Martin Lindström (martin@idsec.se), Henrik Bengtsson (extern.henrik.bengtsson@digg.se), Henric Norlander (extern.henric.norlander@digg.se)
    • Constructor Detail

      • DefaultBarcodeDecoder

        public DefaultBarcodeDecoder()
    • Method Detail

      • decode

        public byte[] decode​(byte[] image,
                             Barcode.BarcodeType type)
                      throws BarcodeException
        Locates the barcode in the supplied image and decodes it.
        Specified by:
        decode in interface BarcodeDecoder
        Parameters:
        image - the bytes of the images holding the barcode
        type - the type of barcode (set to null if not known)
        Returns:
        the contents of the barcode
        Throws:
        BarcodeException - for decoding errors
      • decodeToString

        public String decodeToString​(byte[] image,
                                     Barcode.BarcodeType type,
                                     Charset characterSet)
                              throws BarcodeException
        Locates the barcode in the supplied image and decodes it into a string of the given character set.
        Specified by:
        decodeToString in interface BarcodeDecoder
        Parameters:
        image - the bytes of the images holding the barcode
        type - the type of barcode (set to null if not known)
        characterSet - the character set
        Returns:
        the contents of the barcode
        Throws:
        BarcodeException - for decoding errors