Package adams.data.barcode.decode
Class ZXing
-
- All Implemented Interfaces:
Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,SizeOfHandler
,Serializable
public class ZXing extends AbstractBarcodeDecoder
Decodes the data in a barcode using the ZXing library.
For more information see:
https://github.com/zxing/zxing
-logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel) The logging level for outputting errors and debugging output. default: WARNING
-autoDetect <boolean> (property: autoDetect) Enable or disable barcode format auto-detection; if disabled, it will attempt to decode using the specified format. default: true
-try-harder <boolean> (property: tryHarder) If enabled, the detection tries harder to locate barcodes (slower). default: false
-format <AZTEC|CODABAR|CODE_39|CODE_93|CODE_128|DATA_MATRIX|EAN_8|EAN_13|ITF|MAXICODE|PDF_417|QR_CODE|RSS_14|RSS_EXPANDED|UPC_A|UPC_E|UPC_EAN_EXTENSION> [-format ...] (property: format) Barcode format type to expect. default:
- Author:
- lx51 (lx51 at students dot waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
m_AutoDetect
Barcode format auto-detection.protected com.google.zxing.BarcodeFormat[]
m_Format
Expected barcode format.protected boolean
m_TryHarder
Whether to try harder detecting a barcode.static String
REPORT_PARAM_FORMAT
Key name for barcode format in the report.static String
REPORT_PARAM_HEIGHT
Key name for barcode height in report.static String
REPORT_PARAM_METADATA_PREFIX
Key name prefix for ZXing result metadata.static String
REPORT_PARAM_WIDTH
Key name for barcode width in report.static String
REPORT_PARAM_X
Key name for barcode top-left x in report.static String
REPORT_PARAM_Y
Key name for barcode top-left y in report.-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description ZXing()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
autoDetectTipText()
Returns the tip text for this property.void
defineOptions()
Adds options to the internal list of options.protected TextContainer
doDecode(AbstractImageContainer image)
Performs the actual decoding.String
formatTipText()
Returns the tip text for this property.boolean
getAutoDetect()
Gets whether barcode format auto-detection is enabled.com.google.zxing.BarcodeFormat[]
getFormat()
Gets the barcode format hint.boolean
getTryHarder()
Returns whether to try harder to find barcodes.String
globalInfo()
Returns a string describing the object.void
setAutoDetect(boolean value)
Enables or disables barcode format auto-detection.void
setFormat(com.google.zxing.BarcodeFormat[] value)
Set barcode format hint.void
setTryHarder(boolean value)
Sets whether to try harder to detect barcodes.String
tryHarderTipText()
Returns the tip text for this property.-
Methods inherited from class adams.data.barcode.decode.AbstractBarcodeDecoder
check, decode
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, initialize, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
Field Detail
-
REPORT_PARAM_METADATA_PREFIX
public static final String REPORT_PARAM_METADATA_PREFIX
Key name prefix for ZXing result metadata.- See Also:
- Constant Field Values
-
REPORT_PARAM_FORMAT
public static final String REPORT_PARAM_FORMAT
Key name for barcode format in the report.- See Also:
- Constant Field Values
-
REPORT_PARAM_X
public static final String REPORT_PARAM_X
Key name for barcode top-left x in report.- See Also:
- Constant Field Values
-
REPORT_PARAM_Y
public static final String REPORT_PARAM_Y
Key name for barcode top-left y in report.- See Also:
- Constant Field Values
-
REPORT_PARAM_WIDTH
public static final String REPORT_PARAM_WIDTH
Key name for barcode width in report.- See Also:
- Constant Field Values
-
REPORT_PARAM_HEIGHT
public static final String REPORT_PARAM_HEIGHT
Key name for barcode height in report.- See Also:
- Constant Field Values
-
m_AutoDetect
protected boolean m_AutoDetect
Barcode format auto-detection.
-
m_TryHarder
protected boolean m_TryHarder
Whether to try harder detecting a barcode.
-
m_Format
protected com.google.zxing.BarcodeFormat[] m_Format
Expected barcode format.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceGlobalInfoSupporter
- Specified by:
globalInfo
in classAbstractOptionHandler
- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceOptionHandler
- Overrides:
defineOptions
in classAbstractOptionHandler
-
setAutoDetect
public void setAutoDetect(boolean value)
Enables or disables barcode format auto-detection.- Parameters:
value
- enable auto-detection?
-
getAutoDetect
public boolean getAutoDetect()
Gets whether barcode format auto-detection is enabled.- Returns:
- enable auto-detection?
-
autoDetectTipText
public String autoDetectTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setTryHarder
public void setTryHarder(boolean value)
Sets whether to try harder to detect barcodes.- Parameters:
value
- true if to try harder
-
getTryHarder
public boolean getTryHarder()
Returns whether to try harder to find barcodes.- Returns:
- true if trying harder
-
tryHarderTipText
public String tryHarderTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setFormat
public void setFormat(com.google.zxing.BarcodeFormat[] value)
Set barcode format hint.- Parameters:
value
- barcode format
-
getFormat
public com.google.zxing.BarcodeFormat[] getFormat()
Gets the barcode format hint.- Returns:
- barcode format
-
formatTipText
public String formatTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
doDecode
protected TextContainer doDecode(AbstractImageContainer image)
Performs the actual decoding.- Specified by:
doDecode
in classAbstractBarcodeDecoder
- Parameters:
image
- the image to extract the barcode from- Returns:
- a TextContainer with the decoded barcode text and (optional) meta-data
-
-