Class BarCodeResult

java.lang.Object
com.aspose.barcode.barcoderecognition.BarCodeResult

public final class BarCodeResult extends Object

Stores recognized barcode data like SingleDecodeType type, string codetext, BarCodeRegionParameters region and other parameters


 This sample shows how to obtain BarCodeResult.
 
 BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.CODE_128, "12345");
 generator.save("test.png");
 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());
     System.out.println("BarCode Confidence: " + result.getConfidence());
     System.out.println("BarCode ReadingQuality: " + result.getReadingQuality());
     System.out.println("BarCode Angle: " + result.getRegion().getAngle());
 }
 

  • Constructor Details

    • BarCodeResult

      public BarCodeResult(BarCodeResult result)

      Creates a a copy of the BarCodeResult class.

      Parameters:
      result - An copy BarCodeResult instance.
  • Method Details

    • getReadingQuality

      public double getReadingQuality()

      Gets the reading quality. Works for 1D and postal barcodes.

      Value: The reading quality percent
    • getConfidence

      public int getConfidence()

      Gets recognition confidence level of the recognized barcode

      Value: BarCodeConfidence.Strong does not have fakes or misrecognitions, BarCodeConfidence.Moderate could sometimes have fakes or incorrect codetext because this confidence level for barcodews with weak cheksum or even without it, BarCodeConfidence.None always has incorrect codetext and could be fake recognitions
    • getCodeText

      public String getCodeText()

      Gets the code text

      Value: The code text of the barcode
    • getCodeBytes

      public byte[] getCodeBytes()

      Gets the encoded code bytes

      Value: The code bytes of the barcode
    • getCodeType

      public SingleDecodeType getCodeType()

      Gets the barcode type

      Value: The type information of the recognized barcode
    • getCodeTypeName

      public String getCodeTypeName()

      Gets the name of the barcode type

      Value: The type name of the recognized barcode
    • getRegion

      public BarCodeRegionParameters getRegion()

      Gets the barcode region

      Value: The region of the recognized barcode
    • getExtended

      public BarCodeExtendedParameters getExtended()

      Gets extended parameters of recognized barcode

      Value: The extended parameters of recognized barcode
    • getCodeText

      public String getCodeText(Charset encoding)

      Gets the code text with encoding.


        

      This example shows how to use GetCodeText:

        BarcodeGenerator gen = new BarcodeGenerator(EncodeTypes.DATA_MATRIX);
              gen.setCodeText("車種名", Charset.forName("932"));
              gen.save("barcode.png", BarCodeImageFormat.PNG);
      
              BarCodeReader reader = new BarCodeReader("barcode.png", DecodeType.DATA_MATRIX);
        for(BarCodeResult result : reader.readBarCodes())
           System.out.println("BarCode CodeText: " + result.getCodeText(Charset.forName("932")));
              

      Parameters:
      encoding - The encoding for codetext.
      Returns:
      A string containing recognized code text.
    • equals

      public boolean equals(Object obj)

      Returns a value indicating whether this instance is equal to a specified BarCodeResult value.

      Overrides:
      equals in class Object
      Parameters:
      obj - An BarCodeResult value to compare to this instance.
      Returns:
      <b>true</b> if obj has the same value as this instance; otherwise, <b>false</b>.
    • hashCode

      public int hashCode()

      Returns the hash code for this instance.

      Overrides:
      hashCode in class Object
      Returns:
      A 32-bit signed integer hash code.
    • toString

      public String toString()

      Returns a human-readable string representation of this BarCodeResult.

      Overrides:
      toString in class Object
      Returns:
      A string that represents this BarCodeResult.
    • deepClone

      public Object deepClone()

      Creates a copy of BarCodeResult class.

      Returns:
      Returns copy of BarCodeResult class.