Class BarcodeURN
- All Implemented Interfaces:
- Serializable,- Cloneable
For better control of the barcode and additional parameters use the BarcodeBuilder from a call to {@link BarcodeType#createBuilder()}.
Barcode URN's are encoded in IIZI as:
    urn:iz-barcode:type:text[:width=w][:height:h][:param1=value1:...:paramN=valueN]
where the valid types are (in lower case):
- AZTEC *,
- CODABAR,
- CODE_39,
- CODE_93,
- CODE_128,
- DATA_MATRIX *,
- EAN_8,
- EAN_13,
- ITF,
- PDF_417 *,
- QR_CODE *,
- UPC_A; and
- UPC_E.
The types marked with an asterisk '*' are two dimensional. Generally all barcodes needs a width and height to be displayed properly.
- Author:
- Christopher Mindus
- See Also:
- Field Summary
- Method SummaryModifier and TypeMethodDescriptionCreates a barcode builder for this barcode URN.- booleanChecks if two instances are equal.- static BarcodeURN- from- (BarcodeType format, String text, int width, int height) Creates a BarcodeURN for a barcode format or type.- static BarcodeURN- from- (BarcodeType format, String text, int width, int height, ErrorCorrectionLevel errorCorrectionLevel) Creates a BarcodeURN for a barcode format or type, and for the QR code format, an optional error correction level.Gets the image target interface for this URN instance.Gets the parameter string for the- URN.toString()method.- getSVG()Gets the URL of this as a data URL containing SVG code for the barcode.- getURL()Gets the URL of this as a data URL containing SVG code for the barcode.- int- hashCode()Hashcode of this instance.- booleanChecks if this instance supports returning the image target interface- {@link IImageTarget}.- Methods inherited from class com.iizix.urn.URN- asURNResource, from, getURNString, isURNResource, toString
- Method Details- frompublic static BarcodeURN from- (BarcodeType format, String text, int width, int height) throws BarcodeException Creates a BarcodeURN for a barcode format or type.- Note: if you specify a width or height that is too small, the resulting barcode might be larger. - For better control of the barcode and additional parameters use the - BarcodeBuilderfrom a call to- {@link BarcodeType#createBuilder()}.- Parameters:
- format- The barcode format or type, must be- non-null. If the format is a QR code, the error correction level will be set to L = Lowest = ~7%.
- text- The barcode text string, must be- non-null.
- width- The width, or zero for smallest, negative width is set to zero (smallest).
- height- The height, or zero for smallest, negative height is set to zero (smallest).
- Throws:
- BarcodeException- If there are missing or invalid parameters assigned in this builder encountered during barcode encoding.
 
- frompublic static BarcodeURN from- (BarcodeType format, String text, int width, int height, ErrorCorrectionLevel errorCorrectionLevel) throws BarcodeException Creates a BarcodeURN for a barcode format or type, and for the QR code format, an optional error correction level.- Note: if you specify a width or height that is too small, the resulting barcode might be larger. - For better control of the barcode and additional parameters use the - BarcodeBuilderfrom a call to- {@link BarcodeType#createBuilder()}.- Parameters:
- format- The barcode format or type, must be- non-null. If the format is a QR code, the error correction level will be set to L = Lowest = ~7%.
- text- The barcode text string, must be- non-null.
- width- The width, or zero for smallest, negative width is set to zero (smallest).
- height- The height, or zero for smallest, negative height is set to zero (smallest).
- errorCorrectionLevel- Only applies to- BarcodeType.QR_CODE,- nullfor default L = Low = ~7% error correction level. If the barcode type is anything else but a QR code, this parameter will be set to- null.
- Throws:
- BarcodeException- If there are missing or invalid parameters assigned in this builder encountered during barcode encoding.
 
- createBuilderCreates a barcode builder for this barcode URN. This method is useful if e.g. a barcode has been read from an image (file) and the size is not present.- Returns:
- A new barcode builder for this barcode URN.
 
- getSVGGets the URL of this as a data URL containing SVG code for the barcode.- Returns:
- The data URL as data:image/svg+xml;base64,<i>data</i>.
 
- getURLGets the URL of this as a data URL containing SVG code for the barcode.- Specified by:
- getURLin class- URN
- Returns:
- The data URL as data:image/svg+xml;base64,<i>data</i>.
- Throws:
- IOException- If there was a problem retrieving the file, an SQL error or other I/O error that caused the URL not to be possible to get (e.g. barcode failure).
 
- isImageTargetSupportedpublic boolean isImageTargetSupported()Checks if this instance supports returning the image target interface- {@link IImageTarget}.- Overrides:
- isImageTargetSupportedin class- URN
- Returns:
- trueas Barcode URN's always supports images in SVG.
 
- getImageTargetGets the image target interface for this URN instance.- Overrides:
- getImageTargetin class- URN
- Returns:
- The image target interface to an SVG image target.
 
- getParamStringGets the parameter string for the- URN.toString()method.- Specified by:
- getParamStringin class- URN
- Returns:
- The parameter string, always non-null.
 
- hashCodepublic int hashCode()Hashcode of this instance.
- equalsChecks if two instances are equal.