public abstract class OneDimensionalCodeWriter extends java.lang.Object implements Writer
Encapsulates functionality and implementation that is common to one-dimensional barcodes.
构造器和说明 |
---|
OneDimensionalCodeWriter() |
限定符和类型 | 方法和说明 |
---|---|
abstract boolean[] |
encode(java.lang.String contents)
Encode the contents to boolean array expression of one-dimensional barcode.
|
BitMatrix |
encode(java.lang.String contents,
BarcodeFormat format,
int width,
int height)
Encode a barcode using the default settings.
|
BitMatrix |
encode(java.lang.String contents,
BarcodeFormat format,
int width,
int height,
java.util.Map<EncodeHintType,?> hints)
Encode the contents following specified format.
|
int |
getDefaultMargin() |
public final BitMatrix encode(java.lang.String contents, BarcodeFormat format, int width, int height) throws WriterException1
Writer
encode
在接口中 Writer
contents
- The contents to encode in the barcodeformat
- The barcode format to generatewidth
- The preferred width in pixelsheight
- The preferred height in pixelsBitMatrix
representing encoded barcode imageWriterException1
- if contents cannot be encoded legally in a formatpublic BitMatrix encode(java.lang.String contents, BarcodeFormat format, int width, int height, java.util.Map<EncodeHintType,?> hints) throws WriterException1
width
and height
are required size. This method may return bigger size
BitMatrix
when specified size is too small. The user can set both width
and
height
to zero to get minimum size barcode. If negative value is set to width
or height
, IllegalArgumentException
is thrown.encode
在接口中 Writer
contents
- The contents to encode in the barcodeformat
- The barcode format to generatewidth
- The preferred width in pixelsheight
- The preferred height in pixelshints
- Additional parameters to supply to the encoderBitMatrix
representing encoded barcode imageWriterException1
- if contents cannot be encoded legally in a formatpublic int getDefaultMargin()
public abstract boolean[] encode(java.lang.String contents)
contents
- barcode contents to encodeboolean[]
of horizontal pixels (false = white, true = black)