Parser#

Defined in package com.scandit.datacapture.parser

Parser#
class Parser : DataCaptureComponent

Added in version 6.1.0

forFormat(dataCaptureContext, dataFormat)#
static @NonNull Parser forFormat(@NonNull DataCaptureContext dataCaptureContext,
        ParserDataFormat dataFormat)

Added in version 6.1.0

Create new parser for the provided data format and context. The license key with which the data capture context was constructed must have the parser feature enabled.

In case the parser could not be constructed, an exception is raised. Information on why creation failed is contained in the exception error message.

fromJson(dataCaptureContext, jsonData)#
static @NonNull Parser fromJson(@NonNull DataCaptureContext dataCaptureContext,
        @NonNull String jsonData)

Added in version 6.3.0

Construct a new parser with the provided JSON serialization. See Serialization for details.

parseString(string)#
@NonNull ParsedData parseString(@NonNull String string)

Added in version 6.1.0

Parses the data string and returns the contained field in the result object. Typical inputs to this method is the data contained in a barcode (see Barcode.data)

In case the data string could not be parsed, an exception is raised. More detailed information on why creation failed is contained in the exception error message.

parseRawData(data)#
@NonNull ParsedData parseRawData(byte[] data)

Added in version 6.1.0

Parses the raw data and returns the contained field in the result object. Typical inputs to this method is the raw data of a barcode (see Barcode.rawData).

In case the data string could not be parsed, an exception is raised. More detailed information on why creation failed is contained in the exception error message.

setOptions(options)#
void setOptions(@NonNull Map<@NonNull String, @NonNull Object> options)

Added in version 6.1.0

Set the provided options on the parser.

Available options depend on the data format type of the parser and are documented for each of the supported data formats.

In case the options are invalid, an exception is raised. More detailed information on why creation failed is contained in the exception error message.

id#
@NonNull String getId()

Added in version 6.3.0

Implemented from DataCaptureComponent. See DataCaptureComponent.id.

updateFromJson(jsonData)#
void updateFromJson(@NonNull String jsonData)

Added in version 6.3.0

Updates the parser according to a JSON serialization. See Serialization for details.