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 booleanm_AutoDetectBarcode format auto-detection.protected com.google.zxing.BarcodeFormat[]m_FormatExpected barcode format.protected booleanm_TryHarderWhether to try harder detecting a barcode.static StringREPORT_PARAM_FORMATKey name for barcode format in the report.static StringREPORT_PARAM_HEIGHTKey name for barcode height in report.static StringREPORT_PARAM_METADATA_PREFIXKey name prefix for ZXing result metadata.static StringREPORT_PARAM_WIDTHKey name for barcode width in report.static StringREPORT_PARAM_XKey name for barcode top-left x in report.static StringREPORT_PARAM_YKey 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 StringautoDetectTipText()Returns the tip text for this property.voiddefineOptions()Adds options to the internal list of options.protected TextContainerdoDecode(AbstractImageContainer image)Performs the actual decoding.StringformatTipText()Returns the tip text for this property.booleangetAutoDetect()Gets whether barcode format auto-detection is enabled.com.google.zxing.BarcodeFormat[]getFormat()Gets the barcode format hint.booleangetTryHarder()Returns whether to try harder to find barcodes.StringglobalInfo()Returns a string describing the object.voidsetAutoDetect(boolean value)Enables or disables barcode format auto-detection.voidsetFormat(com.google.zxing.BarcodeFormat[] value)Set barcode format hint.voidsetTryHarder(boolean value)Sets whether to try harder to detect barcodes.StringtryHarderTipText()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:
globalInfoin interfaceGlobalInfoSupporter- Specified by:
globalInfoin classAbstractOptionHandler- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptionsin interfaceOptionHandler- Overrides:
defineOptionsin 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:
doDecodein classAbstractBarcodeDecoder- Parameters:
image- the image to extract the barcode from- Returns:
- a TextContainer with the decoded barcode text and (optional) meta-data
-
-