public abstract class ResultParser extends Object
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.
| Constructor and Description |
|---|
ResultParser()
|
| Modifier and Type | Method and Description |
|---|---|
protected static String |
getMassagedText(Result
|
protected static boolean |
isStringOfDigits(CharSequence
|
protected static boolean |
isSubstringOfDigits(CharSequence
|
protected static void |
maybeAppend(String
|
protected static void |
maybeAppend(String
|
protected static String |
maybeWrap(String
|
abstract ParsedResult |
parse(Result
Attempts to parse the raw
Result's contents as a particular type of information (email, URL, etc.) and return a
ParsedResult encapsulating the result of parsing.
|
protected static int |
parseHexDigit(char c)
|
static ParsedResult |
parseResult(Result
|
protected static String |
unescapeBackslash(String
|
public abstract ParsedResultparse(Result theResult)
Result's contents as a particular type of information (email, URL, etc.) and return a
ParsedResult encapsulating the result of parsing.
theResult - the raw
Result to parse
ParsedResult encapsulating the parsing result
public static ParsedResultparseResult(Result theResult)
protected static void maybeAppend(Stringvalue, StringBuilder result)
protected static void maybeAppend(String[] value, StringBuilder result)
protected static int parseHexDigit(char c)
protected static boolean isStringOfDigits(CharSequencevalue, int length)
protected static boolean isSubstringOfDigits(CharSequencevalue, int offset, int length)