Class BarCodeReader
BarCodeReader encapsulates an image which may contain one or several barcodes, it then can perform ReadBarCodes operation to detect barcodes.
This sample shows how to detect Code39 and Code128 barcodes.BarCodeReader reader = new BarCodeReader("test.png", DecodeType.CODE_39, DecodeType.CODE_128); for(BarCodeResult result : reader.readBarCodes()) { System.out.println("BarCode Type: " + result.getCodeTypeName()); System.out.println("BarCode CodeText: " + result.getCodeText()); }
-
Constructor Summary
ConstructorsConstructorDescriptionInitializes a new instance of theBarCodeReaderclass with default values.BarCodeReader(android.graphics.Bitmap image) Initializes a new instance of theBarCodeReaderclass from an image.BarCodeReader(android.graphics.Bitmap image, android.graphics.Rect[] areas, BaseDecodeType type) Initializes a new instance of theBarCodeReaderclass.BarCodeReader(android.graphics.Bitmap image, android.graphics.Rect area, BaseDecodeType type) BarCodeReader(android.graphics.Bitmap image, android.graphics.Rect area, BaseDecodeType... decodeTypes) Initializes a new instance of theBarCodeReaderclass.BarCodeReader(android.graphics.Bitmap image, BaseDecodeType type) Initializes a new instance of theBarCodeReaderclass.BarCodeReader(android.graphics.Bitmap image, BaseDecodeType... decodeTypes) Initializes a new instance of theBarCodeReaderclass.BarCodeReader(InputStream stream) Initializes a new instance of theBarCodeReaderclass.BarCodeReader(InputStream stream, android.graphics.Rect[] areas, BaseDecodeType type) Initializes a new instance of theBarCodeReaderclass.BarCodeReader(InputStream stream, android.graphics.Rect area, BaseDecodeType type) Initializes a new instance of theBarCodeReaderclass.BarCodeReader(InputStream stream, BaseDecodeType type) Initializes a new instance of theBarCodeReaderclass.BarCodeReader(InputStream stream, BaseDecodeType... decodeTypes) Initializes a new instance of theBarCodeReaderclass.BarCodeReader(String filename) Initializes a new instance of theBarCodeReaderclass from file.BarCodeReader(String imagePath, android.graphics.Rect[] areas, BaseDecodeType type) Initializes a new instance of theBarCodeReaderclass.BarCodeReader(String imagePath, android.graphics.Rect area, BaseDecodeType type) Initializes a new instance of theBarCodeReaderclass.BarCodeReader(String filename, BaseDecodeType type) Initializes a new instance of theBarCodeReaderclass.BarCodeReader(String filename, BaseDecodeType... decodeTypes) Initializes a new instance of theBarCodeReaderclass. -
Method Summary
Modifier and TypeMethodDescriptionvoidabort()Function requests termination of current recognition session from other thread.voiddispose()booleanexportToXml(OutputStream xmlStream) Exports BarCode properties to the xml-stream specifiedbooleanexportToXml(String xmlFile) Exports BarCode properties to the xml-file specifiedGets the decode type of the input barcode decodingThe main BarCode decoding parameters.Gets recognizedBarCodeResults arrayintGets recognized barcodes countstatic ProcessorSettingsGets a settings of using processor cores.final QualitySettingsQualitySettings allows to configure recognition quality and speed manually.intGets the timeout of recognition process in milliseconds.static BarCodeReaderimportFromXml(InputStream xmlStream) Imports BarCode properties from the xml-stream specified and applies them to the current BarCodeReader instance.static BarCodeReaderimportFromXml(String xmlFile) Imports BarCode properties from the xml-file specified and applies them to the current BarCodeReader instance.ReadsBarCodeResults from the image.voidsetBarCodeImage(android.graphics.Bitmap value) Sets bitmap image for recognition.final voidsetBarCodeImage(android.graphics.Bitmap value, android.graphics.Rect area) Sets bitmap image and area for recognition.final voidsetBarCodeImage(android.graphics.Bitmap value, android.graphics.Rect[] areas) Sets bitmap image and areas for recognition.final voidsetBarCodeImage(InputStream stream) Sets image stream for recognition.voidsetBarCodeImage(String filename) Sets image file for recognition.voidSets decode type for recognition.voidsetBarCodeReadType(SingleDecodeType... barcodeTypes) SetsSingleDecodeTypetype array for recognition.final voidQualitySettings allows to configure recognition quality and speed manually.voidsetTimeout(int value) Sets the timeout of recognition process in milliseconds.
-
Constructor Details
-
BarCodeReader
public BarCodeReader()Initializes a new instance of the
BarCodeReaderclass with default values. Requires to set image (SetBitmapImage()) before to call ReadBarCodes() method.This sample shows how to detect Code39 and Code128 barcodes.
BarCodeReader reader = new BarCodeReader(); reader.setBarCodeReadType(DecodeType.CODE_39, DecodeType.CODE_128); reader.setBarCodeImage("test.png"); for(BarCodeResult result : reader.readBarCodes()) { System.out.println("BarCode Type: " + result.getCodeTypeName()); System.out.println("BarCode CodeText: " + result.getCodeText()); } -
BarCodeReader
public BarCodeReader(android.graphics.Bitmap image) Initializes a new instance of the
BarCodeReaderclass from an image.This sample shows how to detect Code39 and Code128 barcodes.
Bitmap bmp = BitmapFactory.decodeFile("test.png"); BarCodeReader reader = new BarCodeReader(bmp); reader.setBarCodeReadType(DecodeType.CODE_39, DecodeType.CODE_128); for(BarCodeResult result : reader.readBarCodes()) { System.out.println("BarCode Type: " + result.getCodeTypeName()); System.out.println("BarCode CodeText: " + result.getCodeText()); }- Parameters:
image- A Bitmap instance containing the image
-
BarCodeReader
Initializes a new instance of the
BarCodeReaderclass.This sample shows how to detect Code39 and Code128 barcodes.
Bitmap bmp = BitmapFactory.decodeFile("test.png"); BarCodeReader reader = new BarCodeReader(bmp, DecodeType.CODE_39, DecodeType.CODE_128); for(BarCodeResult result : reader.readBarCodes()) { System.out.println("BarCode Type: " + result.getCodeTypeName()); System.out.println("BarCode CodeText: " + result.getCodeText()); }- Parameters:
image- The image.decodeTypes- Decode types.
-
BarCodeReader
Initializes a new instance of the
BarCodeReaderclass.This sample shows how to detect Code39 and Code128 barcodes.
Bitmap bmp = BitmapFactory.decodeFile("test.png"); BarCodeReader reader = new BarCodeReader(bmp, new MultiDecodeType(DecodeType.CODE_39, DecodeType.CODE_128); for(BarCodeResult result : reader.readBarCodes()) { System.out.println("BarCode Type: " + result.getCodeTypeName()); System.out.println("BarCode CodeText: " + result.getCodeText()); }- Parameters:
image- The image.type- The decode type1. It can be single or multy
-
BarCodeReader
public BarCodeReader(android.graphics.Bitmap image, android.graphics.Rect area, BaseDecodeType... decodeTypes) Initializes a new instance of the
BarCodeReaderclass.This sample shows how to detect Code39 and Code128 barcodes.
Bitmap bmp = BitmapFactory.decodeFile("test.png"); BarCodeReader reader = new BarCodeReader(bmp, new Rectangle(0, 0, bmp.getWidth(), bmp.getHeight()), DecodeType.CODE_39, DecodeType.CODE_128); for(BarCodeResult result : reader.readBarCodes()) { System.out.println("BarCode Type: " + result.getCodeTypeName()); System.out.println("BarCode CodeText: " + result.getCodeText()); }- Parameters:
image- The image.area- The area for recognition.decodeTypes- Decode types.
-
BarCodeReader
Initializes a new instance of the
BarCodeReaderclass.This sample shows how to detect Code39 and Code128 barcodes.
BufferedImage bmp = ImageIO.read(new File("c:\\test.png")); BarCodeReader reader = new BarCodeReader(bmp, new Rectangle(0, 0, bmp.getWidth(), bmp.getHeight()), new MultiDecodeType(DecodeType.CODE_39, DecodeType.CODE_128); for(BarCodeResult result : reader.readBarCodes()) { System.out.println("BarCode Type: " + result.getCodeTypeName()); System.out.println("BarCode CodeText: " + result.getCodeText()); }- Parameters:
imagePath- The image path.areas- The area for recognition.type- The decode type.
-
BarCodeReader
Initializes a new instance of the
BarCodeReaderclass.This sample shows how to detect Code39 and Code128 barcodes.
BufferedImage bmp = ImageIO.read(new File("c:\\test.png")); BarCodeReader reader = new BarCodeReader(bmp, new Rectangle(0, 0, bmp.getWidth(), bmp.getHeight()), new MultiDecodeType(DecodeType.CODE_39, DecodeType.CODE_128); for(BarCodeResult result : reader.readBarCodes()) { System.out.println("BarCode Type: " + result.getCodeTypeName()); System.out.println("BarCode CodeText: " + result.getCodeText()); }- Parameters:
stream- The image stream.area- The area for recognition.type- The decode type.
-
BarCodeReader
Initializes a new instance of the
BarCodeReaderclass.This sample shows how to detect Code39 and Code128 barcodes.
BufferedImage bmp = ImageIO.read(new File("c:\\test.png")); BarCodeReader reader = new BarCodeReader(bmp, new Rectangle(0, 0, bmp.getWidth(), bmp.getHeight()), new MultiDecodeType(DecodeType.CODE_39, DecodeType.CODE_128); for(BarCodeResult result : reader.readBarCodes()) { System.out.println("BarCode Type: " + result.getCodeTypeName()); System.out.println("BarCode CodeText: " + result.getCodeText()); }- Parameters:
imagePath- The image path.area- The area for recognition.type- The decode type.
-
BarCodeReader
Initializes a new instance of the
BarCodeReaderclass.This sample shows how to detect Code39 and Code128 barcodes.
BufferedImage bmp = ImageIO.read(new File("c:\\test.png")); BarCodeReader reader = new BarCodeReader(bmp, new Rectangle(0, 0, bmp.getWidth(), bmp.getHeight()), new MultiDecodeType(DecodeType.CODE_39, DecodeType.CODE_128); for(BarCodeResult result : reader.readBarCodes()) { System.out.println("BarCode Type: " + result.getCodeTypeName()); System.out.println("BarCode CodeText: " + result.getCodeText()); }- Parameters:
stream- The image stream.areas- The area for recognition.type- The decode type.
-
BarCodeReader
public BarCodeReader(android.graphics.Bitmap image, android.graphics.Rect[] areas, BaseDecodeType type) Initializes a new instance of the
BarCodeReaderclass.This sample shows how to detect Code39 and Code128 barcodes.
Bitmap bmp = BitmapFactory.decodeFile("test.png"); BarCodeReader reader = new BarCodeReader(bmp, new Rectangle(0, 0, bmp.getWidth(), bmp.getHeight()), new MultiDecodeType(DecodeType.CODE_39, DecodeType.CODE_128); for(BarCodeResult result : reader.readBarCodes()) { System.out.println("BarCode Type: " + result.getCodeTypeName()); System.out.println("BarCode CodeText: " + result.getCodeText()); }- Parameters:
image- The image.areas- The areas for recognition.type- The decode type.
-
BarCodeReader
public BarCodeReader(android.graphics.Bitmap image, android.graphics.Rect area, BaseDecodeType type) -
BarCodeReader
Initializes a new instance of the
BarCodeReaderclass from file.This sample shows how to detect Code39 and Code128 barcodes.
BarCodeReader reader = new BarCodeReader("test.png"); reader.setBarCodeReadType(DecodeType.CODE_39, DecodeType.CODE_128); for(BarCodeResult result : reader.readBarCodes()) { System.out.println("BarCode Type: " + result.getCodeTypeName()); System.out.println("BarCode CodeText: " + result.getCodeText()); }- Parameters:
filename- The filename.
-
BarCodeReader
Initializes a new instance of the
BarCodeReaderclass.This sample shows how to detect Code39 and Code128 barcodes.
BarCodeReader reader = new BarCodeReader("test.png", new MultiDecodeType(DecodeType.CODE_39, DecodeType.CODE_128); for(BarCodeResult result : reader.readBarCodes()) { System.out.println("BarCode Type: " + result.getCodeTypeName()); System.out.println("BarCode CodeText: " + result.getCodeText()); }- Parameters:
filename- The filename.type- The decode type.
-
BarCodeReader
Initializes a new instance of the
BarCodeReaderclass.This sample shows how to detect Code39 and Code128 barcodes.
BarCodeReader reader = new BarCodeReader("test.png", DecodeType.CODE_39, DecodeType.CODE_128); for(BarCodeResult result : reader.readBarCodes()) { System.out.println("BarCode Type: " + result.getCodeTypeName()); System.out.println("BarCode CodeText: " + result.getCodeText()); }- Parameters:
filename- The filename.decodeTypes- Decode types.
-
BarCodeReader
Initializes a new instance of the
BarCodeReaderclass.This sample shows how to detect Code39 and Code128 barcodes.
InputStream fstr = new FileInputStream(new File("test.png")); BarCodeReader reader = new BarCodeReader(fstr); reader.setBarCodeReadType(DecodeType.CODE_39, DecodeType.CODE_128); for(BarCodeResult result : reader.readBarCodes()) { System.out.println("BarCode Type: " + result.getCodeTypeName()); System.out.println("BarCode CodeText: " + result.getCodeText()); }- Parameters:
stream- The stream.- Throws:
IOException
-
BarCodeReader
Initializes a new instance of the
BarCodeReaderclass.This sample shows how to detect Code39 and Code128 barcodes.
InputStream fstr = new FileInputStream("test.png"); BarCodeReader reader = new BarCodeReader(fstr, new MultiDecodeType(DecodeType.CODE_39, DecodeType.CODE_128); for(BarCodeResult result : reader.readBarCodes()) { System.out.println("BarCode Type: " + result.getCodeTypeName()); System.out.println("BarCode CodeText: " + result.getCodeText()); }- Parameters:
stream- The stream.type- The decode type.- Throws:
IOException
-
BarCodeReader
Initializes a new instance of the
BarCodeReaderclass.This sample shows how to detect Code39 and Code128 barcodes.
InputStream fstr = new FileInputStream("test.png")); BarCodeReader reader = new BarCodeReader(fstr, DecodeType.CODE_39, DecodeType.CODE_128); for(BarCodeResult result : reader.readBarCodes()) { System.out.println("BarCode Type: " + result.getCodeTypeName()); System.out.println("BarCode CodeText: " + result.getCodeText()); }- Parameters:
stream- The stream.decodeTypes- Decode types.- Throws:
IOException
-
-
Method Details
-
getProcessorSettings
Gets a settings of using processor cores.
This sample shows how to use ProcessorSettings to add maximum multi-threaded performnce
//this allows to use all cores for single BarCodeReader call BarCodeReader.getProcessorSettings().setUseAllCores(true); //this allows to use current count of cores BarCodeReader.getProcessorSettings().setUseAllCores(false); BarCodeReader.getProcessorSettings().setUseOnlyThisCoresCount(Math.max(1, Environment.getProcessorCount() / 2));
-
getTimeout
public int getTimeout()Gets the timeout of recognition process in milliseconds.
BarCodeReader reader = new BarCodeReader("test.png"); reader.setTimeout(5000); for(BarCodeResult result : reader.readBarCodes()) System.out.println("BarCode CodeText: " + result.getCodeText());- Returns:
- The timeout.
-
setTimeout
public void setTimeout(int value) Sets the timeout of recognition process in milliseconds.
BarCodeReader reader = new BarCodeReader("test.png"); reader.setTimeout(5000); for(BarCodeResult result : reader.readBarCodes()) System.out.println("BarCode CodeText: " + result.getCodeText());- Parameters:
value- The timeout.
-
abort
public void abort()Function requests termination of current recognition session from other thread. Abort is unblockable method and returns control just after calling. The method should be used when recognition process is too long.
This sample shows how to call Abort function from other thread
final BarCodeReader reader = new BarCodeReader("test.png", DecodeType.CODE_39, DecodeType.CODE_128); Thread thread1 = new Thread(new Runnable() { -
getFoundBarCodes
Gets recognized
BarCodeResults array
Value: The recognizedThis sample shows how to read barcodes with BarCodeReader
BarCodeReader reader = new BarCodeReader("test.png", DecodeType.CODE_39, DecodeType.CODE_128); { reader.readBarCodes(); for(int i = 0; reader.getFoundCount() > i; ++i) System.out.println("BarCode CodeText: " + reader.getFoundBarCodes()[i].getCodeText()); }BarCodeResults array -
getFoundCount
public int getFoundCount()Gets recognized barcodes count
Value: The recognized barcodes countThis sample shows how to read barcodes with BarCodeReader
BarCodeReader reader = new BarCodeReader("test.png", DecodeType.CODE_39, DecodeType.CODE_128); reader.readBarCodes(); for(int i = 0; reader.getFoundCount() > i; ++i) System.out.println("BarCode CodeText: " + reader.getFoundBarCodes()[i].getCodeText()); -
readBarCodes
Reads
BarCodeResults from the image.This sample shows how to read barcodes with BarCodeReader
BarCodeReader reader = new BarCodeReader("test.png", DecodeType.CODE_39, DecodeType.CODE_128); for(BarCodeResult result : reader.readBarCodes()) System.out.println("BarCode CodeText: " + result.getCodeText()); BarCodeReader reader = new BarCodeReader("test.png", DecodeType.CODE_39, DecodeType.CODE_128); reader.readBarCodes(); for(int i = 0; reader.getFoundCount() > i; ++i) System.out.println("BarCode CodeText: " + reader.getFoundBarCodes()[i].getCodeText());- Returns:
- Returns array of recognized
BarCodeResults on the image. If nothing is recognized, zero array is returned.
-
getQualitySettings
QualitySettings allows to configure recognition quality and speed manually. You can quickly set up QualitySettings by embedded presets: HighPerformance, NormalQuality, HighQuality, MaxBarCodes or you can manually configure separate options. Default value of QualitySettings is NormalQuality.
Value: QualitySettings to configure recognition quality and speed.This sample shows how to use QualitySettings with BarCodeReader
BarCodeReader reader = new BarCodeReader("test.png", DecodeType.CODE_39, DecodeType.CODE_128); //set high performance mode reader.setQualitySettings(QualitySettings.getHighPerformance()); for(BarCodeResult result : reader.readBarCodes()) System.out.println("BarCode CodeText: " + result.getCodeText()); BarCodeReader reader = new BarCodeReader("test.png", DecodeType.CODE_39, DecodeType.CODE_128); //normal quality mode is set by default for(BarCodeResult result : reader.readBarCodes()) System.out.println("BarCode CodeText: " + result.getCodeText()); BarCodeReader reader = new BarCodeReader("test.png", DecodeType.CODE_39, DecodeType.CODE_128); //set high performance mode reader.setQualitySettings(QualitySettings.getHighPerformance()); //set separate options reader.getQualitySettings().setAllowMedianSmoothing(true); reader.getQualitySettings().setMedianSmoothingWindowSize(5); for(BarCodeResult result : reader.readBarCodes()) System.out.println("BarCode CodeText: " + result.getCodeText()); -
setQualitySettings
QualitySettings allows to configure recognition quality and speed manually. You can quickly set up QualitySettings by embedded presets: HighPerformance, NormalQuality, HighQuality, MaxBarCodes or you can manually configure separate options. Default value of QualitySettings is NormalQuality.
Value: QualitySettings to configure recognition quality and speed.This sample shows how to use QualitySettings with BarCodeReader
BarCodeReader reader = new BarCodeReader("test.png", DecodeType.CODE_39, DecodeType.CODE_128); //set high performance mode reader.setQualitySettings(QualitySettings.getHighPerformance()); for(BarCodeResult result : reader.readBarCodes()) System.out.println("BarCode CodeText: " + result.getCodeText()); BarCodeReader reader = new BarCodeReader("test.png", DecodeType.CODE_39, DecodeType.CODE_128); //normal quality mode is set by default for(BarCodeResult result : reader.readBarCodes()) System.out.println("BarCode CodeText: " + result.getCodeText()); BarCodeReader reader = new BarCodeReader("test.png", DecodeType.CODE_39, DecodeType.CODE_128); //set high performance mode reader.setQualitySettings(QualitySettings.getHighPerformance()); //set separate options reader.getQualitySettings().setAllowMedianSmoothing(true); reader.getQualitySettings().setMedianSmoothingWindowSize(5); for(BarCodeResult result : reader.readBarCodes()) System.out.println("BarCode CodeText: " + result.getCodeText()); -
getBarcodeSettings
The main BarCode decoding parameters. Contains parameters which make influence on recognized data.- Returns:
- The main BarCode decoding parameters
-
setBarCodeImage
public final void setBarCodeImage(android.graphics.Bitmap value, android.graphics.Rect[] areas) Sets bitmap image and areas for recognition. Must be called before ReadBarCodes() method.
This sample shows how to detect Code39 and Code128 barcodes.
Bitmap bmp = BitmapFactory.decodeFile("test.png"); BarCodeReader reader = new BarCodeReader(); reader.setBarCodeReadType(DecodeType.CODE_39, DecodeType.CODE_128); reader.setBarCodeImage(bmp, new Rectangle[] { new Rectangle(0, 0, bmp.getWidth(), bmp.getHeight()) }); for(BarCodeResult result : reader.readBarCodes()) { System.out.println("BarCode Type: " + result.getCodeTypeName()); System.out.println("BarCode CodeText: " + result.getCodeText()); }- Parameters:
value- The bitmap image for recognition.areas- areas list for recognition
-
setBarCodeImage
public final void setBarCodeImage(android.graphics.Bitmap value, android.graphics.Rect area) Sets bitmap image and area for recognition. Must be called before ReadBarCodes() method.
This sample shows how to detect Code39 and Code128 barcodes.
Bitmap bmp = BitmapFactory.decodeFile("test.png"); BarCodeReader reader = new BarCodeReader(); reader.setBarCodeReadType(DecodeType.CODE_39, DecodeType.CODE_128); reader.setBarCodeImage(bmp, new Rectangle(0, 0, bmp.getWidth(), bmp.getHeight())); for(BarCodeResult result : reader.readBarCodes()) { System.out.println("BarCode Type: " + result.getCodeTypeName()); System.out.println("BarCode CodeText: " + result.getCodeText()); }- Parameters:
value- The bitmap image for recognition.area- area for recognition
-
setBarCodeImage
Sets image stream for recognition. Must be called before ReadBarCodes() method.
This sample shows how to detect Code39 and Code128 barcodes.
InputStream fstr = new FileInputStream(new File("test.png")); BarCodeReader reader = new BarCodeReader(); reader.setBarCodeReadType(DecodeType.CODE_39, DecodeType.CODE_128); reader.setBarCodeImage(fstr); for(BarCodeResult result : reader.readBarCodes()) { System.out.println("BarCode Type: " + result.getCodeTypeName()); System.out.println("BarCode CodeText: " + result.getCodeText()); }- Parameters:
stream- The image stream for recogniton.
-
setBarCodeImage
public void setBarCodeImage(android.graphics.Bitmap value) Sets bitmap image for recognition. Must be called before ReadBarCodes() method.
This sample shows how to detect Code39 and Code128 barcodes.
Bitmap bmp = BitmapFactory.decodeFile("test.png"); BarCodeReader reader = new BarCodeReader()) { reader.setBarCodeReadType(DecodeType.CODE_39, DecodeType.CODE_128); reader.setBarCodeImage(bmp); for(BarCodeResult result : reader.readBarCodes()) { System.out.println("BarCode Type: " + result.getCodeTypeName()); System.out.println("BarCode CodeText: " + result.getCodeText()); } }- Parameters:
value- The bitmap image for recognition.
-
setBarCodeImage
Sets image file for recognition. Must be called before ReadBarCodes() method.
This sample shows how to detect Code39 and Code128 barcodes.
BarCodeReader reader = new BarCodeReader()) { reader.setBarCodeReadType(DecodeType.CODE_39, DecodeType.CODE_128); reader.setBarCodeImage("test.png"); for(BarCodeResult result : reader.readBarCodes()) { System.out.println("BarCode Type: " + result.getCodeTypeName()); System.out.println("BarCode CodeText: " + result.getCodeText()); } }- Parameters:
filename- The image file for recogniton.
-
setBarCodeReadType
Sets
SingleDecodeTypetype array for recognition. Must be called before ReadBarCodes() method.This sample shows how to detect Code39 and Code128 barcodes.
BarCodeReader reader = new BarCodeReader(); reader.setBarCodeReadType(DecodeType.CODE_39, DecodeType.CODE_128); reader.setBarCodeImage("test.png"); for(BarCodeResult result : reader.readBarCodes()) { System.out.println("BarCode Type: " + result.getCodeTypeName()); System.out.println("BarCode CodeText: " + result.getCodeText()); }- Parameters:
barcodeTypes- TheSingleDecodeTypetype array to read.
-
setBarCodeReadType
Sets decode type for recognition. Must be called before ReadBarCodes() method.
This sample shows how to detect Code39 and Code128 barcodes.
BarCodeReader reader = new BarCodeReader(); reader.setBarCodeReadType(new MultiDecodeType(DecodeType.CODE_39, DecodeType.CODE_128); reader.setBarCodeImage("test.png"); for(BarCodeResult result : reader.readBarCodes()) { System.out.println("BarCode Type: " + result.getCodeTypeName()); System.out.println("BarCode CodeText: " + result.getCodeText()); } System.out.println("BarCodeReadType: " + reader.getBarCodeReadType().toString());- Parameters:
type- The type of barcode to read.
-
getBarCodeReadType
Gets the decode type of the input barcode decoding -
dispose
public void dispose() -
exportToXml
Exports BarCode properties to the xml-file specified
- Parameters:
xmlFile- The name of the file- Returns:
- Whether or not export completed successfully.
Returns
<b>True</b>in case of success;<b>False</b>Otherwise
-
exportToXml
Exports BarCode properties to the xml-stream specified
- Parameters:
xmlStream- The xml-stream for saving- Returns:
- Whether or not export completed successfully.
Returns
<b>True</b>in case of success;<b>False</b>Otherwise - Throws:
IOException
-
importFromXml
Imports BarCode properties from the xml-file specified and applies them to the current BarCodeReader instance.
- Parameters:
xmlFile- The name of the file- Returns:
- Returns
<b>True</b>in case of success;<b>False</b>Otherwise
-
importFromXml
Imports BarCode properties from the xml-stream specified and applies them to the current BarCodeReader instance.
- Parameters:
xmlStream- The xml-stream for loading- Returns:
- Returns
<b>True</b>in case of success;<b>False</b>Otherwise
-