Class ResultParser
java.lang.Object
com.google.zxing.client.result.ResultParser
- Direct Known Subclasses:
AbstractDoCoMoResultParser, AddressBookAUResultParser, EmailAddressResultParser, ExpandedProductResultParser, GeoResultParser, ISBNResultParser, ProductResultParser, SMSMMSResultParser, SMSTOMMSTOResultParser, SMTPResultParser, TelResultParser, URIResultParser, URLTOResultParser, VCardResultParser, VEventResultParser, VINResultParser, WifiResultParser
Abstract class representing the result of decoding a barcode, as more than
a String -- as some type of structured data. This might be a subclass which represents
a URL, or an e-mail address. parseResult(Result) will turn a raw
decoded string into the most appropriate type of structured representation.
Thanks to Jeff Griffin for proposing rewrite of these classes that relies less on exception-based mechanisms during parsing.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static voidappendKeyValue(CharSequence keyValue, Map<String, String> result) private static intcountPrecedingBackslashes(CharSequence s, int pos) protected static StringgetMassagedText(Result result) protected static booleanisStringOfDigits(CharSequence value, int length) protected static booleanisSubstringOfDigits(CharSequence value, int offset, int length) (package private) static String[]matchPrefixedField(String prefix, String rawText, char endChar, boolean trim) (package private) static StringmatchSinglePrefixedField(String prefix, String rawText, char endChar, boolean trim) protected static voidmaybeAppend(String[] value, StringBuilder result) protected static voidmaybeAppend(String value, StringBuilder result) protected static String[]abstract ParsedResultAttempts to parse the rawResult's contents as a particular type of information (email, URL, etc.) and return aParsedResultencapsulating the result of parsing.protected static intparseHexDigit(char c) static ParsedResultparseResult(Result theResult) protected static StringunescapeBackslash(String escaped) (package private) static String
-
Field Details
-
PARSERS
-
DIGITS
-
AMPERSAND
-
EQUALS
-
BYTE_ORDER_MARK
- See Also:
-
EMPTY_STR_ARRAY
-
-
Constructor Details
-
ResultParser
public ResultParser()
-
-
Method Details
-
parse
Attempts to parse the rawResult's contents as a particular type of information (email, URL, etc.) and return aParsedResultencapsulating the result of parsing.- Parameters:
theResult- the rawResultto parse- Returns:
ParsedResultencapsulating the parsing result
-
getMassagedText
-
parseResult
-
maybeAppend
-
maybeAppend
-
maybeWrap
-
unescapeBackslash
-
parseHexDigit
protected static int parseHexDigit(char c) -
isStringOfDigits
-
isSubstringOfDigits
-
parseNameValuePairs
-
appendKeyValue
-
urlDecode
-
matchPrefixedField
-
countPrecedingBackslashes
-
matchSinglePrefixedField
-