Package com.iizix.barcode
Class BarcodeData
- java.lang.Object
- com.iizix.barcode.BarcodeData
public class BarcodeData extends java.lang.Object
Class 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 BarcodeURN
asURN()
Gets the URN representation of this barcode if it is encodable.BarcodeURN
asURN(int width, int height)
Gets the URN representation of this barcode if it is encodable, in the requested size.BarcodeBuilder
createBuilder()
Creates a barcode builder with the barcode type and text.boolean
equals(java.lang.Object obj)
Checks if this barcode data is equal to another object.java.lang.String
getFormatString()
Gets the string representation of the barcode format.java.lang.String
getText()
Gets the barcode text.long
getTimeStamp()
Gets the timestamp when the barcode was decoded.BarcodeType
getType()
Gets the iizi barcode type if it is encodable.BarcodeFormat
getZxingFormat()
Gets the barcode Zxing format enum.int
hashCode()
Returns the hashcode of the barcode data.java.lang.String
toString()
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
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 methodasURN(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:
java.lang.IllegalArgumentException
- If thesize
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 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:
hashCode
in 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:
equals
in 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:
toString
in classjava.lang.Object
- Returns:
- String as
className[format=nn,type=type,text=txt,timeStamp=tsString]
.