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 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 createGlobalTradeItemNumber(java.lang.String data)
          Creates a Global Trade Item Number (GTIN) based on the UCC/EAN 128 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 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 createUCC128(java.lang.String applicationIdentifier, java.lang.String data)
          Creates a UCC 128 barcode.
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.
 
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

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

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