Package com.google.zxing.client.result
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 void
appendKeyValue
(CharSequence keyValue, Map<String, String> result) private static int
countPrecedingBackslashes
(CharSequence s, int pos) protected static String
getMassagedText
(Result result) protected static boolean
isStringOfDigits
(CharSequence value, int length) protected static boolean
isSubstringOfDigits
(CharSequence value, int offset, int length) (package private) static String[]
matchPrefixedField
(String prefix, String rawText, char endChar, boolean trim) (package private) static String
matchSinglePrefixedField
(String prefix, String rawText, char endChar, boolean trim) protected static void
maybeAppend
(String[] value, StringBuilder result) protected static void
maybeAppend
(String value, StringBuilder result) protected static String[]
abstract ParsedResult
Attempts to parse the rawResult
's contents as a particular type of information (email, URL, etc.) and return aParsedResult
encapsulating the result of parsing.protected static int
parseHexDigit
(char c) static ParsedResult
parseResult
(Result theResult) protected static String
unescapeBackslash
(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 aParsedResult
encapsulating the result of parsing.- Parameters:
theResult
- the rawResult
to parse- Returns:
ParsedResult
encapsulating the parsing result
-
getMassagedText
-
parseResult
-
maybeAppend
-
maybeAppend
-
maybeWrap
-
unescapeBackslash
-
parseHexDigit
protected static int parseHexDigit(char c) -
isStringOfDigits
-
isSubstringOfDigits
-
parseNameValuePairs
-
appendKeyValue
-
urlDecode
-
matchPrefixedField
-
countPrecedingBackslashes
-
matchSinglePrefixedField
-