Package com.iizix.barcode
Class BarcodeData
- java.lang.Object
- com.iizix.barcode.BarcodeData
public class BarcodeData extends java.lang.ObjectClass containing the barcode that has been read from an image.- Author:
- Christopher Mindus
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BarcodeURNasURN()Gets the URN representation of this barcode if it is encodable.BarcodeURNasURN(int width, int height)Gets the URN representation of this barcode if it is encodable, in the requested size.BarcodeBuildercreateBuilder()Creates a barcode builder with the barcode type and text.booleanequals(java.lang.Object obj)Checks if this barcode data is equal to another object.java.lang.StringgetFormatString()Gets the string representation of the barcode format.java.lang.StringgetText()Gets the barcode text.longgetTimeStamp()Gets the timestamp when the barcode was decoded.BarcodeTypegetType()Gets the IIZI barcode type if it is encodable.BarcodeFormatgetZxingFormat()Gets the barcode Zxing format enum.inthashCode()Returns the hashcode of the barcode data.java.lang.StringtoString()Gets a String representation of the barcode data.
Method Detail
getText
public java.lang.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
nullif 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 methodasURN(int, int).- Returns:
- The barcode URN without size (smallest size possible), or
nullif 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
nullif it cannot be encoded. - Throws:
java.lang.IllegalArgumentException- If thesizeis 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
nullif the barcode is not encodable.
getFormatString
public java.lang.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:
hashCodein classjava.lang.Object- Returns:
- The hashcode.
equals
public boolean equals(java.lang.Object obj)
Checks if this barcode data is equal to another object.- Overrides:
equalsin classjava.lang.Object- Returns:
- true if it's the same class and the values are the same, false otherwise.
toString
public java.lang.String toString()
Gets a String representation of the barcode data.- Overrides:
toStringin classjava.lang.Object- Returns:
- String as
className[format=nn,type=type,text=txt,timeStamp=tsString].