Package com.google.zxing.client.result
Class VCardResultParser
java.lang.Object
com.google.zxing.client.result.ResultParser
com.google.zxing.client.result.VCardResultParser
Parses contact information formatted according to the VCard (2.1) format. This is not a complete
implementation but should parse information as commonly encoded in 2D barcodes.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Pattern
private static final Pattern
private static final Pattern
private static final Pattern
private static final Pattern
private static final Pattern
private static final Pattern
private static final Pattern
private static final Pattern
private static final Pattern
Fields inherited from class com.google.zxing.client.result.ResultParser
EMPTY_STR_ARRAY
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static String
decodeQuotedPrintable
(CharSequence value, String charset) private static void
formatNames
(Iterable<List<String>> names) Formats name fields of the form "Public;John;Q.;Reverend;III" into a form like "Reverend John Q.private static boolean
isLikeVCardDate
(CharSequence value) matchSingleVCardPrefixedField
(CharSequence prefix, String rawText, boolean trim, boolean parseFieldDivider) matchVCardPrefixedField
(CharSequence prefix, String rawText, boolean trim, boolean parseFieldDivider) private static void
maybeAppendComponent
(String[] components, int i, StringBuilder newName) private static void
maybeAppendFragment
(ByteArrayOutputStream fragmentBuffer, String charset, StringBuilder 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.private static String
toPrimaryValue
(List<String> list) private static String[]
toPrimaryValues
(Collection<List<String>> lists) private static String[]
toTypes
(Collection<List<String>> lists) Methods inherited from class com.google.zxing.client.result.ResultParser
getMassagedText, isStringOfDigits, isSubstringOfDigits, matchPrefixedField, matchSinglePrefixedField, maybeAppend, maybeAppend, maybeWrap, parseHexDigit, parseNameValuePairs, parseResult, unescapeBackslash, urlDecode
-
Field Details
-
BEGIN_VCARD
-
VCARD_LIKE_DATE
-
CR_LF_SPACE_TAB
-
NEWLINE_ESCAPE
-
VCARD_ESCAPES
-
EQUALS
-
SEMICOLON
-
UNESCAPED_SEMICOLONS
-
COMMA
-
SEMICOLON_OR_COMMA
-
-
Constructor Details
-
VCardResultParser
public VCardResultParser()
-
-
Method Details
-
parse
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
-
matchVCardPrefixedField
static List<List<String>> matchVCardPrefixedField(CharSequence prefix, String rawText, boolean trim, boolean parseFieldDivider) -
decodeQuotedPrintable
-
maybeAppendFragment
private static void maybeAppendFragment(ByteArrayOutputStream fragmentBuffer, String charset, StringBuilder result) -
matchSingleVCardPrefixedField
static List<String> matchSingleVCardPrefixedField(CharSequence prefix, String rawText, boolean trim, boolean parseFieldDivider) -
toPrimaryValue
-
toPrimaryValues
-
toTypes
-
isLikeVCardDate
-
formatNames
Formats name fields of the form "Public;John;Q.;Reverend;III" into a form like "Reverend John Q. Public III".- Parameters:
names
- name values to format, in place
-
maybeAppendComponent
-