net.sourceforge.barbecue
Class BarcodeFactory

java.lang.Object
  extended bynet.sourceforge.barbecue.BarcodeFactory

public final class BarcodeFactory
extends java.lang.Object

This factory provides a standard way of creating barcodes.

Author:
Ian Bourke

Method Summary
static Barcode create2of7(java.lang.String data)
          Creates a 2 of 7 (Codabar) linear barcode.
static Barcode create3of9(java.lang.String data, boolean requiresChecksum)
          Creates a Code 3 of 9 (Code 39) linear barcode.
static Barcode createBookland(java.lang.String isbn)
          Creates a Bookland barcode, which is based on the EAN 13 Symbology.
static Barcode createCodabar(java.lang.String data)
          Creates a Codabar linear barcode.
static Barcode createCode128(java.lang.String data)
          Creates a Code 128 barcode that dynamically switches between character sets to give the smallest possible encoding.
static Barcode createCode128A(java.lang.String data)
          Creates a Code 128 barcode using the A character set.
static Barcode createCode128B(java.lang.String data)
          Creates a Code 128 barcode using the B character set.
static Barcode createCode128C(java.lang.String data)
          Creates a Code 128 barcode using the C character set.
static Barcode createCode39(java.lang.String data, boolean requiresChecksum)
          Creates a Code 39 linear barcode.
static Barcode createEAN128(java.lang.String data)
          Creates a EAN 128 barcode.
static Barcode createEAN13(java.lang.String data)
          Creates a barcode based on the EAN 13 Symbology.
static Barcode createGlobalTradeItemNumber(java.lang.String data)
          Creates a Global Trade Item Number (GTIN) based on the UCC/EAN 128 symbology.
static Barcode createInt2of5(java.lang.String data)
          Creates a barcode based on the Interleave 2 of 5 Symbology.
static Barcode createInt2of5(java.lang.String data, boolean checkDigit)
          Creates a barcode based on the Interleave 2 of 5 Symbology.
static Barcode createMonarch(java.lang.String data)
          Creates a Monarch (Codabar) linear barcode.
static Barcode createNW7(java.lang.String data)
          Creates a NW-7 (Codabar) linear barcode.
static Barcode createPDF417(java.lang.String data)
          Creates a PDF417 two dimensional barcode.
static Barcode createPostNet(java.lang.String data)
          Creates a PostNet linear barcode.
static Barcode createRandomWeightUPCA(java.lang.String data)
          Creates a barcode based on the UPC-A Symbology signifying a random weight.
static Barcode createSCC14ShippingCode(java.lang.String data)
          Creates an SCC-14 shipping code number based on the UCC/EAN 128 symbology.
static Barcode createShipmentIdentificationNumber(java.lang.String data)
          Creates a shipment identification number based on the UCC/EAN 128 symbology.
static Barcode createSSCC18(java.lang.String data)
          Creates an SSCC-18 number based on the UCC/EAN 128 symbology.
static Barcode createStd2of5(java.lang.String data)
          Creates a barcode based on the Standard 2 of 5 Symbology.
static Barcode createStd2of5(java.lang.String data, boolean checkDigit)
          Creates a barcode based on the Standard 2 of 5 Symbology.
static Barcode createUCC128(java.lang.String applicationIdentifier, java.lang.String data)
          Creates a UCC 128 barcode.
static Barcode createUPCA(java.lang.String data)
          Creates a barcode based on the UPC-A Symbology.
static Barcode createUSD3(java.lang.String data, boolean requiresChecksum)
          Creates a USD3 (Code 39) linear barcode.
static Barcode createUSD4(java.lang.String data)
          Creates a USD-4 (Codabar) linear barcode.
static Barcode createUSPS(java.lang.String data)
          Creates a US Postal Service barcode based on the UCC/EAN 128 symbology.
static Barcode parseEAN128(java.lang.String encoded_data)
          Create an EAN128 barcode with multiple application identifiers (AI's).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createCode128

public static Barcode createCode128(java.lang.String data)
                             throws BarcodeException
Creates a Code 128 barcode that dynamically switches between character sets to give the smallest possible encoding. This will encode all numeric characters, upper and lower case alpha characters and control characters from the standard ASCII character set. The size of the barcode created will be the smallest possible for the given data, and use of this "optimal" encoding will generally give smaller barcodes than any of the other 3 "vanilla" encodings.

Parameters:
data - The data to encode
Returns:
The barcode
Throws:
BarcodeException - If the data to be encoded is invalid

createCode128A

public static Barcode createCode128A(java.lang.String data)
                              throws BarcodeException
Creates a Code 128 barcode using the A character set. This will encode all numeric characters, upper case alpha characters and control characters from the standard ASCII character set. The Code 128 barcode supports on-the-fly character set changes using the appropriate code change symbol. The type A barcode also supports a one character 'shift' to set B.

Parameters:
data - The data to encode
Returns:
The barcode
Throws:
BarcodeException - If the data to be encoded is invalid

createCode128B

public static Barcode createCode128B(java.lang.String data)
                              throws BarcodeException
Creates a Code 128 barcode using the B character set. This will encode all numeric characters and upper and lower case alpha characters from the standard ASCII character set. The Code 128 barcode supports on-the-fly character set changes using the appropriate code change symbol. The type B barcode also supports a one character 'shift' to set A.

Parameters:
data - The data to encode
Returns:
The barcode
Throws:
BarcodeException - If the data to be encoded is invalid

createCode128C

public static Barcode createCode128C(java.lang.String data)
                              throws BarcodeException
Creates a Code 128 barcode using the C character set. This will encode only numeric characters in a double density format (e.g. 1 digit in the barcode encodes two digits in the data). The Code 128 barcode supports on-the-fly character set changes using the appropriate code change symbol. No shifts are possible with the type C barcode.

Parameters:
data - The data to encode
Returns:
The barcode
Throws:
BarcodeException - If the data to be encoded is invalid

createUCC128

public static Barcode createUCC128(java.lang.String applicationIdentifier,
                                   java.lang.String data)
                            throws BarcodeException
Creates a UCC 128 barcode. This will encode numeric characters and must include the correct application identifier for the application domain in which you wish to use the barcode.

Parameters:
applicationIdentifier - The application identifier for the domain
data - The data to encode
Returns:
The barcode
Throws:
BarcodeException - If the data to be encoded is invalid

createEAN128

public static Barcode createEAN128(java.lang.String data)
                            throws BarcodeException
Creates a EAN 128 barcode.

Parameters:
data - The data to encode
Returns:
The barcode
Throws:
BarcodeException - If the data to be encoded is invalid

createUSPS

public static Barcode createUSPS(java.lang.String data)
                          throws BarcodeException
Creates a US Postal Service barcode based on the UCC/EAN 128 symbology.

Parameters:
data - The data to encode
Returns:
The barcode
Throws:
BarcodeException - If the data to be encoded is invalid

createShipmentIdentificationNumber

public static Barcode createShipmentIdentificationNumber(java.lang.String data)
                                                  throws BarcodeException
Creates a shipment identification number based on the UCC/EAN 128 symbology.

Parameters:
data - The data to encode
Returns:
The barcode
Throws:
BarcodeException - If the data to be encoded is invalid

parseEAN128

public static Barcode parseEAN128(java.lang.String encoded_data)
                           throws BarcodeException
Create an EAN128 barcode with multiple application identifiers (AI's). The data is specified in a string of the form (ai) data (ai) data. For example (01)0941919600001(10)012004(21)000001 will create a barcode consisting of a GTIN AI (01) and the data '0941919600001' (note: the GTIN check digit is calculated automatically.), then a lot AI (10) followed by the lot number '012004', and an item AI (21) with item number 000001.

Throws:
BarcodeException

createSSCC18

public static Barcode createSSCC18(java.lang.String data)
                            throws BarcodeException
Creates an SSCC-18 number based on the UCC/EAN 128 symbology.

Parameters:
data - The data to encode
Returns:
The barcode
Throws:
BarcodeException - If the data to be encoded is invalid

createSCC14ShippingCode

public static Barcode createSCC14ShippingCode(java.lang.String data)
                                       throws BarcodeException
Creates an SCC-14 shipping code number based on the UCC/EAN 128 symbology.

Parameters:
data - The data to encode
Returns:
The barcode
Throws:
BarcodeException - If the data to be encoded is invalid

createGlobalTradeItemNumber

public static Barcode createGlobalTradeItemNumber(java.lang.String data)
                                           throws BarcodeException
Creates a Global Trade Item Number (GTIN) based on the UCC/EAN 128 symbology.

Parameters:
data - The data to encode
Returns:
The barcode
Throws:
BarcodeException - If the data to be encoded is invalid

createEAN13

public static Barcode createEAN13(java.lang.String data)
                           throws BarcodeException
Creates a barcode based on the EAN 13 Symbology.

Parameters:
data - The data to encode
Returns:
The barcode
Throws:
BarcodeException - If the data to be encoded is invalid

createBookland

public static Barcode createBookland(java.lang.String isbn)
                              throws BarcodeException
Creates a Bookland barcode, which is based on the EAN 13 Symbology. For example, if you createBookland("968-26-1240-3") you will receive an EAN 13 barcode of 9789682612404. Note that only the '-' character will be automaticaly removed from the ISBN data.

Parameters:
isbn - The ISBN of the book to encode
Returns:
The barcode
Throws:
BarcodeException - If the data to be encoded is invalid

createUPCA

public static Barcode createUPCA(java.lang.String data)
                          throws BarcodeException
Creates a barcode based on the UPC-A Symbology.

Parameters:
data - The data to encode
Returns:
The barcode
Throws:
BarcodeException - If the data to be encoded is invalid

createRandomWeightUPCA

public static Barcode createRandomWeightUPCA(java.lang.String data)
                                      throws BarcodeException
Creates a barcode based on the UPC-A Symbology signifying a random weight.

Parameters:
data - The data to encode
Returns:
The barcode
Throws:
BarcodeException - If the data to be encoded is invalid

createStd2of5

public static Barcode createStd2of5(java.lang.String data)
                             throws BarcodeException
Creates a barcode based on the Standard 2 of 5 Symbology.

Parameters:
data - The data to encode
Returns:
The barcode
Throws:
BarcodeException - If the data to be encoded is invalid
See Also:
createStd2of5(String, boolean)

createStd2of5

public static Barcode createStd2of5(java.lang.String data,
                                    boolean checkDigit)
                             throws BarcodeException
Creates a barcode based on the Standard 2 of 5 Symbology.

Parameters:
data - The data to encode
checkDigit - if true then a check digit is appended automatically
Returns:
The barcode
Throws:
BarcodeException - If the data to be encoded is invalid
See Also:
createStd2of5(String)

createInt2of5

public static Barcode createInt2of5(java.lang.String data)
                             throws BarcodeException
Creates a barcode based on the Interleave 2 of 5 Symbology.

Parameters:
data - The data to encode
Returns:
The barcode
Throws:
BarcodeException - If the data to be encoded is invalid
See Also:
createInt2of5(String, boolean)

createInt2of5

public static Barcode createInt2of5(java.lang.String data,
                                    boolean checkDigit)
                             throws BarcodeException
Creates a barcode based on the Interleave 2 of 5 Symbology.

Parameters:
data - The data to encode
checkDigit - if true then a check digit is appended automatically
Returns:
The barcode
Throws:
BarcodeException - If the data to be encoded is invalid
See Also:
createInt2of5(String)

createPDF417

public static Barcode createPDF417(java.lang.String data)
                            throws BarcodeException
Creates a PDF417 two dimensional barcode.

Parameters:
data - The data to encode
Returns:
The barcode
Throws:
BarcodeException - If the data to be encoded is invalid

createCode39

public static Barcode createCode39(java.lang.String data,
                                   boolean requiresChecksum)
                            throws BarcodeException
Creates a Code 39 linear barcode.

Parameters:
data - The data to encode
requiresChecksum - True if a check digit is required, false if not
Returns:
The barcode
Throws:
BarcodeException - If the data to be encoded is invalid

create3of9

public static Barcode create3of9(java.lang.String data,
                                 boolean requiresChecksum)
                          throws BarcodeException
Creates a Code 3 of 9 (Code 39) linear barcode.

Parameters:
data - The data to encode
requiresChecksum - True if a check digit is required, false if not
Returns:
The barcode
Throws:
BarcodeException - If the data to be encoded is invalid

createUSD3

public static Barcode createUSD3(java.lang.String data,
                                 boolean requiresChecksum)
                          throws BarcodeException
Creates a USD3 (Code 39) linear barcode.

Parameters:
data - The data to encode
requiresChecksum - True if a check digit is required, false if not
Returns:
The barcode
Throws:
BarcodeException - If the data to be encoded is invalid

createCodabar

public static Barcode createCodabar(java.lang.String data)
                             throws BarcodeException
Creates a Codabar linear barcode.

Parameters:
data - The data to encode
Returns:
The barcode
Throws:
BarcodeException - If the data to be encoded is invalid

createUSD4

public static Barcode createUSD4(java.lang.String data)
                          throws BarcodeException
Creates a USD-4 (Codabar) linear barcode.

Parameters:
data - The data to encode
Returns:
The barcode
Throws:
BarcodeException - If the data to be encoded is invalid

createNW7

public static Barcode createNW7(java.lang.String data)
                         throws BarcodeException
Creates a NW-7 (Codabar) linear barcode.

Parameters:
data - The data to encode
Returns:
The barcode
Throws:
BarcodeException - If the data to be encoded is invalid

createMonarch

public static Barcode createMonarch(java.lang.String data)
                             throws BarcodeException
Creates a Monarch (Codabar) linear barcode.

Parameters:
data - The data to encode
Returns:
The barcode
Throws:
BarcodeException - If the data to be encoded is invalid

create2of7

public static Barcode create2of7(java.lang.String data)
                          throws BarcodeException
Creates a 2 of 7 (Codabar) linear barcode.

Parameters:
data - The data to encode
Returns:
The barcode
Throws:
BarcodeException - If the data to be encoded is invalid

createPostNet

public static Barcode createPostNet(java.lang.String data)
                             throws BarcodeException
Creates a PostNet linear barcode.

Parameters:
data - The data to encode
Returns:
The barcode
Throws:
BarcodeException - If the data to be encoded is invalid


Copyright © 2003-2007 barbecue.sourceforge.net. All Rights Reserved.