Working with Barcode Recognition State using XML in Java

Overview

Aspose.BarCode for Java provides class BarCodeReader that enables serializing the current barcode recognition state and saving it using the XML format to a file through the exportToXml(java.lang.String xmlFile) method or a stream through the exportToXml(java.io.OutputStream xmlStream) method. In addition, it is possible to import the barcode state in the XML format from a file or a stream using corresponding methods importFromXml(java.lang.String xmlFile) and importFromXml(java.io.InputStream xmlStream).

However, serializing cannot be implemented automatically for some barcode data, including the barcode image itself and the link to the source file. If needed, this can be done through the setBarCodeImage() method.

Outputting Barcode Recognition State in XML Format

In Aspose.BarCode for Java, there are two options to save the current state of class BarCodeReader: to an XML file using the exportToXml(java.lang.String xmlFile) method or a stream using the exportToXml(java.io.OutputStream xmlStream) method.

Loading Barcode Recognition State from XML

The current barcode recognition state corresponding to an object of class BarCodeReader can be loaded from an XML file through the importFromXml(java.lang.String xmlFile) method or a stream through the importFromXml(java.io.InputStream xmlStream) method. The source barcode image needs to be determined using the setBarCodeImage method.

Loading and Saving Barcode Recognition State from Stream

In Aspose.BarCode for Java, it is possible to save or load the barcode reading state from a stream using special methods exportToXml(java.io.OutputStream xmlStream) and importFromXml(java.io.InputStream xmlStream). The source barcode image needs to be specified explicitly using the setBarCodeImage() method.