Package com.google.zxing.client.result
Class URIResultParser
- java.lang.Object
-
- com.google.zxing.client.result.ResultParser
-
- com.google.zxing.client.result.URIResultParser
-
public final class URIResultParser extends ResultParser
Tries to parse results that are a URI of some kind.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.regex.Pattern
ALLOWED_URI_CHARS_PATTERN
private static java.util.regex.Pattern
URL_WITH_PROTOCOL_PATTERN
private static java.util.regex.Pattern
URL_WITHOUT_PROTOCOL_PATTERN
private static java.util.regex.Pattern
USER_IN_HOST
-
Fields inherited from class com.google.zxing.client.result.ResultParser
EMPTY_STR_ARRAY
-
-
Constructor Summary
Constructors Constructor Description URIResultParser()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) static boolean
isBasicallyValidURI(java.lang.String uri)
(package private) static boolean
isPossiblyMaliciousURI(java.lang.String uri)
URIParsedResult
parse(Result result)
Attempts to parse the rawResult
's contents as a particular type of information (email, URL, etc.) and return aParsedResult
encapsulating the result of parsing.-
Methods inherited from class com.google.zxing.client.result.ResultParser
getMassagedText, isStringOfDigits, isSubstringOfDigits, matchPrefixedField, matchSinglePrefixedField, maybeAppend, maybeAppend, maybeWrap, parseHexDigit, parseNameValuePairs, parseResult, unescapeBackslash, urlDecode
-
-
-
-
Field Detail
-
ALLOWED_URI_CHARS_PATTERN
private static final java.util.regex.Pattern ALLOWED_URI_CHARS_PATTERN
-
USER_IN_HOST
private static final java.util.regex.Pattern USER_IN_HOST
-
URL_WITH_PROTOCOL_PATTERN
private static final java.util.regex.Pattern URL_WITH_PROTOCOL_PATTERN
-
URL_WITHOUT_PROTOCOL_PATTERN
private static final java.util.regex.Pattern URL_WITHOUT_PROTOCOL_PATTERN
-
-
Method Detail
-
parse
public URIParsedResult parse(Result result)
Description copied from class:ResultParser
Attempts to parse the rawResult
's contents as a particular type of information (email, URL, etc.) and return aParsedResult
encapsulating the result of parsing.- Specified by:
parse
in classResultParser
- Parameters:
result
- the rawResult
to parse- Returns:
ParsedResult
encapsulating the parsing result
-
isPossiblyMaliciousURI
static boolean isPossiblyMaliciousURI(java.lang.String uri)
- Returns:
- true if the URI contains suspicious patterns that may suggest it intends to mislead the user about its true nature. At the moment this looks for the presence of user/password syntax in the host/authority portion of a URI which may be used in attempts to make the URI's host appear to be other than it is. Example: http://yourbank.com@phisher.com This URI connects to phisher.com but may appear to connect to yourbank.com at first glance.
-
isBasicallyValidURI
static boolean isBasicallyValidURI(java.lang.String uri)
-
-