Package se.digg.dgc.encoding.impl
Class DefaultBarcodeDecoder
- java.lang.Object
-
- se.digg.dgc.encoding.impl.DefaultBarcodeDecoder
-
- All Implemented Interfaces:
BarcodeDecoder
public class DefaultBarcodeDecoder extends Object implements BarcodeDecoder
Default implementation of theBarcodeDecoder
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 Summary
Constructors Constructor Description DefaultBarcodeDecoder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]
decode(byte[] image, Barcode.BarcodeType type)
Locates the barcode in the supplied image and decodes it.String
decodeToString(byte[] image, Barcode.BarcodeType type, Charset characterSet)
Locates the barcode in the supplied image and decodes it into a string of the given character set.
-
-
-
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 interfaceBarcodeDecoder
- Parameters:
image
- the bytes of the images holding the barcodetype
- 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 interfaceBarcodeDecoder
- Parameters:
image
- the bytes of the images holding the barcodetype
- 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
-
-