com.google.zxing.oned
Class AbstractUPCEANWriter

java.lang.Object
  extended by com.google.zxing.oned.AbstractUPCEANWriter
All Implemented Interfaces:
UPCEANWriter, Writer
Direct Known Subclasses:
Code128Writer, Code39Writer, EAN13Writer, EAN8Writer, ITFWriter

public abstract class AbstractUPCEANWriter
extends Object
implements UPCEANWriter

Encapsulates functionality and implementation that is common to UPC and EAN families of one-dimensional barcodes.

Since:
BlackBerry API 6.0.0

Constructor Summary
AbstractUPCEANWriter()
           
 
Method Summary
protected static int appendPattern(byte[] target, int pos, int[] pattern, int startColor)
          Appends the given pattern to the target array starting at pos.
abstract  byte[] encode(String contents)
           
 ByteMatrix encode(String contents, BarcodeFormat format, int width, int height)
          Encode a barcode using the default settings.
 ByteMatrix encode(String contents, BarcodeFormat format, int width, int height, Hashtable hints)
          Encode a barcode using the provided parameters.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 



Constructor Detail

AbstractUPCEANWriter

public AbstractUPCEANWriter()
Since:
BlackBerry API 6.0.0


Method Detail

encode

public ByteMatrix encode(String contents,
                         BarcodeFormat format,
                         int width,
                         int height)
                  throws WriterException
Description copied from interface: Writer
Encode a barcode using the default settings.

Specified by:
encode in interface Writer
Parameters:
contents - The contents to encode in the barcode
format - The barcode format to generate
width - The preferred width in pixels
height - The preferred height in pixels
Returns:
The generated barcode as a ByteMatrix of unsigned bytes (0 == black, 255 == white)
Throws:
WriterException
Since:
BlackBerry API 6.0.0

encode

public ByteMatrix encode(String contents,
                         BarcodeFormat format,
                         int width,
                         int height,
                         Hashtable hints)
                  throws WriterException
Description copied from interface: Writer
Encode a barcode using the provided parameters.

Specified by:
encode in interface Writer
Parameters:
contents - The contents to encode in the barcode
format - The barcode format to generate
width - The preferred width in pixels
height - The preferred height in pixels
hints - Additional parameters to supply to the encoder
Returns:
The generated barcode as a ByteMatrix of unsigned bytes (0 == black, 255 == white)
Throws:
WriterException
Since:
BlackBerry API 6.0.0

appendPattern

protected static int appendPattern(byte[] target,
                                   int pos,
                                   int[] pattern,
                                   int startColor)
Appends the given pattern to the target array starting at pos.

Parameters:
startColor - starting color - 0 for white, 1 for black
Returns:
the number of elements added to target.
Since:
BlackBerry API 6.0.0

encode

public abstract byte[] encode(String contents)
Specified by:
encode in interface UPCEANWriter
Returns:
a byte array of horizontal pixels (0 = white, 1 = black)
Since:
BlackBerry API 7.0.0





Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal