Class BarcodeData

java.lang.Object
com.iizix.barcode.BarcodeData

public class BarcodeData extends Object
Class containing the barcode that has been read from an image.
Author:
Christopher Mindus
  • Method Details

    • getText

      public String getText()
      Gets the barcode text.
      Returns:
      The text.
    • getType

      public BarcodeType getType()
      Gets the IIZI barcode type if it is encodable.
      Returns:
      The barcode type, or null if it cannot be re-encoded.
    • asURN

      public BarcodeURN asURN() throws BarcodeException
      Gets the URN representation of this barcode if it is encodable.

      Please note that you need to assign a size to the barcode to encoded it.

      Use the BarcodeURN.createBuilder() to do so, or use the method asURN(int, int).

      Returns:
      The barcode URN without size (smallest size possible), or null if it cannot be encoded.
      Throws:
      BarcodeException - If the text cannot be encoded in the barcode type or format.
    • asURN

      public BarcodeURN asURN(int width, int height) throws BarcodeException
      Gets the URN representation of this barcode if it is encodable, in the requested size.

      Use the BarcodeURN.createBuilder() if you wish to add more parameters for encoding and place that information in a BarcodeURN.

      Note that the values can be enlarged if the barcode bitmap does not fit inside the requested dimension.

      Parameters:
      width - The width.
      height - The height.
      Returns:
      The barcode with the specified size, or null if it cannot be encoded.
      Throws:
      IllegalArgumentException - If the size is negative.
      BarcodeException
    • createBuilder

      public BarcodeBuilder createBuilder()
      Creates a barcode builder with the barcode type and text.

      The builder is in non-validating mode, if one is created.

      Returns:
      The barcode builder initialized with the type and text, or null if the barcode is not encodable.
    • getFormatString

      public String getFormatString()
      Gets the string representation of the barcode format.
      Returns:
      A string of the barcode format.
    • getZxingFormat

      public BarcodeFormat getZxingFormat()
      Gets the barcode Zxing format enum.
      Returns:
      The Zxing barcode format.
    • getTimeStamp

      public long getTimeStamp()
      Gets the timestamp when the barcode was decoded.
      Returns:
      A timestamp in milliseconds since the Epoch.
    • hashCode

      public int hashCode()
      Returns the hashcode of the barcode data.
      Overrides:
      hashCode in class Object
      Returns:
      The hashcode.
    • equals

      public boolean equals(Object obj)
      Checks if this barcode data is equal to another object.
      Overrides:
      equals in class Object
      Returns:
      true if it's the same class and the values are the same, false otherwise.
    • toString

      public String toString()
      Gets a String representation of the barcode data.
      Overrides:
      toString in class Object
      Returns:
      String as className[format=nn,type=type,text=txt,timeStamp=tsString].