public class BarcodeDataFormat extends Object implements org.apache.camel.spi.DataFormat
DataFormat
to create (encode) and
read (decode) barcodes. For more info about
the available barcodes have a look at:Constructor and Description |
---|
BarcodeDataFormat()
Create instance with default parameters.
|
BarcodeDataFormat(com.google.zxing.BarcodeFormat format)
Create instance with custom
BarcodeFormat . |
BarcodeDataFormat(BarcodeImageType type)
Create instance with custom
BarcodeImageType . |
BarcodeDataFormat(int width,
int height)
Create instance with custom height and width.
|
BarcodeDataFormat(int width,
int height,
BarcodeImageType type,
com.google.zxing.BarcodeFormat format)
Create instance with custom height, width and image type.
|
Modifier and Type | Method and Description |
---|---|
void |
addToHintMap(com.google.zxing.DecodeHintType hintType,
Object value)
Adds a new hint value to reader (decode) hint map.
|
void |
addToHintMap(com.google.zxing.EncodeHintType hintType,
Object value)
Adds a new hint value to writer (encode) hint map.
|
BarcodeParameters |
getParams()
The (default) parameters.
|
Map<com.google.zxing.DecodeHintType,Object> |
getReaderHintMap()
The reader (decode) hint map.
|
Map<com.google.zxing.EncodeHintType,Object> |
getWriterHintMap()
The writer (encode) hint map.
|
void |
marshal(org.apache.camel.Exchange exchange,
Object graph,
OutputStream stream)
Marshall a
String payload to a code image. |
protected void |
optimizeHints()
Sets hints optimized for different barcode types.
|
void |
removeFromHintMap(com.google.zxing.DecodeHintType hintType)
Removes a hint from reader (decode) hint map.
|
void |
removeFromHintMap(com.google.zxing.EncodeHintType hintType)
Removes a hint from writer (encode) hint map.
|
void |
setBarcodeFormat(com.google.zxing.BarcodeFormat format) |
void |
setBarcodeImageType(BarcodeImageType type) |
protected void |
setDefaultParameters()
Sets the default parameters.
|
void |
setHeight(Integer height) |
void |
setWidth(Integer width) |
Object |
unmarshal(org.apache.camel.Exchange exchange,
InputStream stream)
Unmarshall a code image to a
String payload. |
public BarcodeDataFormat()
public BarcodeDataFormat(com.google.zxing.BarcodeFormat format)
BarcodeFormat
. The other
values are default.format
- the barcode formatpublic BarcodeDataFormat(int width, int height)
height
- the image heightwidth
- the image widthpublic BarcodeDataFormat(BarcodeImageType type)
BarcodeImageType
. The other
values are default.type
- the type (format) of the image. e.g. PNGpublic BarcodeDataFormat(int width, int height, BarcodeImageType type, com.google.zxing.BarcodeFormat format)
height
- the image heightwidth
- the image widthtype
- the type (format) of the image. e.g. PNGformat
- the barcode formatpublic void marshal(org.apache.camel.Exchange exchange, Object graph, OutputStream stream) throws Exception
String
payload to a code image.marshal
in interface org.apache.camel.spi.DataFormat
exchange
- graph
- stream
- Exception
public Object unmarshal(org.apache.camel.Exchange exchange, InputStream stream) throws Exception
String
payload.unmarshal
in interface org.apache.camel.spi.DataFormat
exchange
- stream
- Exception
protected final void setDefaultParameters()
protected final void optimizeHints()
public final void addToHintMap(com.google.zxing.EncodeHintType hintType, Object value)
hintType
- value
- public final void addToHintMap(com.google.zxing.DecodeHintType hintType, Object value)
hintType
- value
- public final void removeFromHintMap(com.google.zxing.EncodeHintType hintType)
hintType
- public final void removeFromHintMap(com.google.zxing.DecodeHintType hintType)
hintType
- public final BarcodeParameters getParams()
public final Map<com.google.zxing.EncodeHintType,Object> getWriterHintMap()
public final Map<com.google.zxing.DecodeHintType,Object> getReaderHintMap()
public void setBarcodeImageType(BarcodeImageType type)
public void setBarcodeFormat(com.google.zxing.BarcodeFormat format)
public void setWidth(Integer width)
public void setHeight(Integer height)
Apache Camel