Class BarcodeDataFormat
java.lang.Object
org.apache.camel.support.service.BaseService
org.apache.camel.support.service.ServiceSupport
org.apache.camel.dataformat.barcode.BarcodeDataFormat
- All Implemented Interfaces:
AutoCloseable,org.apache.camel.Service,org.apache.camel.ShutdownableService,org.apache.camel.spi.DataFormat,org.apache.camel.spi.DataFormatName,org.apache.camel.StatefulService,org.apache.camel.SuspendableService
@Dataformat("barcode")
public class BarcodeDataFormat
extends org.apache.camel.support.service.ServiceSupport
implements org.apache.camel.spi.DataFormat, org.apache.camel.spi.DataFormatName
DataFormat to create (encode) and read (decode) barcodes. For more info about the available barcodes have a
look at:https://github.com/zxing/zxing
-
Field Summary
Fields inherited from class org.apache.camel.support.service.BaseService
BUILT, FAILED, INITIALIZED, INITIALIZING, lock, NEW, SHUTDOWN, SHUTTING_DOWN, STARTED, STARTING, status, STOPPED, STOPPING, SUSPENDED, SUSPENDING -
Constructor Summary
ConstructorsConstructorDescriptionCreate instance with default parameters.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.BarcodeDataFormat(com.google.zxing.BarcodeFormat format) Create instance with customBarcodeFormat.Create instance with customBarcodeImageType. -
Method Summary
Modifier and TypeMethodDescriptionfinal voidaddToHintMap(com.google.zxing.DecodeHintType hintType, Object value) Adds a new hint value to reader (decode) hint map.final voidaddToHintMap(com.google.zxing.EncodeHintType hintType, Object value) Adds a new hint value to writer (encode) hint map.protected voiddoStart()protected voiddoStop()final BarcodeParametersThe (default) parameters.The reader (decode) hint map.The writer (encode) hint map.voidmarshal(org.apache.camel.Exchange exchange, Object graph, OutputStream stream) Marshall aStringpayload to a code image.protected final voidSets hints optimized for different barcode types.final voidremoveFromHintMap(com.google.zxing.DecodeHintType hintType) Removes a hint from reader (decode) hint map.final voidremoveFromHintMap(com.google.zxing.EncodeHintType hintType) Removes a hint from writer (encode) hint map.voidsetBarcodeFormat(com.google.zxing.BarcodeFormat format) voidprotected final voidSets the default parameters.voidvoidunmarshal(org.apache.camel.Exchange exchange, InputStream stream) Unmarshall a code image to aStringpayload.Methods inherited from class org.apache.camel.support.service.BaseService
build, doBuild, doFail, doInit, doLifecycleChange, doResume, doShutdown, doSuspend, fail, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspendMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.camel.Service
build, close, init, start, stopMethods inherited from interface org.apache.camel.ShutdownableService
shutdownMethods inherited from interface org.apache.camel.StatefulService
getStatus, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspendingMethods inherited from interface org.apache.camel.SuspendableService
isSuspended, resume, suspend
-
Constructor Details
-
BarcodeDataFormat
public BarcodeDataFormat()Create instance with default parameters. -
BarcodeDataFormat
public BarcodeDataFormat(com.google.zxing.BarcodeFormat format) Create instance with customBarcodeFormat. The other values are default.- Parameters:
format- the barcode format
-
BarcodeDataFormat
public BarcodeDataFormat(int width, int height) Create instance with custom height and width. The other values are default.- Parameters:
width- the image widthheight- the image height
-
BarcodeDataFormat
Create instance with customBarcodeImageType. The other values are default.- Parameters:
type- the type (format) of the image. e.g. PNG
-
BarcodeDataFormat
public BarcodeDataFormat(int width, int height, BarcodeImageType type, com.google.zxing.BarcodeFormat format) Create instance with custom height, width and image type. The other values are default.- Parameters:
width- the image widthheight- the image heighttype- the type (format) of the image. e.g. PNGformat- the barcode format
-
-
Method Details
-
getDataFormatName
- Specified by:
getDataFormatNamein interfaceorg.apache.camel.spi.DataFormatName
-
marshal
public void marshal(org.apache.camel.Exchange exchange, Object graph, OutputStream stream) throws Exception Marshall aStringpayload to a code image.- Specified by:
marshalin interfaceorg.apache.camel.spi.DataFormat- Throws:
Exception
-
unmarshal
Unmarshall a code image to aStringpayload.- Specified by:
unmarshalin interfaceorg.apache.camel.spi.DataFormat- Throws:
Exception
-
setDefaultParameters
protected final void setDefaultParameters()Sets the default parameters. -
optimizeHints
protected final void optimizeHints()Sets hints optimized for different barcode types. -
addToHintMap
Adds a new hint value to writer (encode) hint map. -
addToHintMap
Adds a new hint value to reader (decode) hint map. -
removeFromHintMap
public final void removeFromHintMap(com.google.zxing.EncodeHintType hintType) Removes a hint from writer (encode) hint map. -
removeFromHintMap
public final void removeFromHintMap(com.google.zxing.DecodeHintType hintType) Removes a hint from reader (decode) hint map. -
getParams
The (default) parameters. -
getWriterHintMap
The writer (encode) hint map. -
getReaderHintMap
The reader (decode) hint map. -
setBarcodeImageType
-
setBarcodeFormat
public void setBarcodeFormat(com.google.zxing.BarcodeFormat format) -
setWidth
-
setHeight
-
doStart
- Overrides:
doStartin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
doStop
- Overrides:
doStopin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-