public class VCardUtils extends Object
Modifier and Type | Class and Description |
---|---|
static class |
VCardUtils.PhoneNumberUtilsPort
Ported methods which are hidden in
PhoneNumberUtils . |
static class |
VCardUtils.TextUtilsPort
Ported methods which are hidden in
TextUtils . |
Modifier and Type | Method and Description |
---|---|
static boolean |
appearsLikeAndroidVCardQuotedPrintable(String value)
Checks to see if a string looks like it could be an android generated quoted printable.
|
static boolean |
areAllEmpty(String... values) |
static List<String> |
constructListFromValue(String value,
int vcardType)
Splits the given value into pieces using the delimiter ';' inside it.
|
static String |
constructNameFromElements(int nameOrder,
String familyName,
String middleName,
String givenName) |
static String |
constructNameFromElements(int nameOrder,
String familyName,
String middleName,
String givenName,
String prefix,
String suffix) |
static boolean |
containsOnlyAlphaDigitHyphen(Collection<String> values) |
static boolean |
containsOnlyAlphaDigitHyphen(String... values)
This is useful since vCard 3.0 often requires the ("X-") properties and groups
should contain only alphabets, digits, and hyphen.
|
static boolean |
containsOnlyNonCrLfPrintableAscii(Collection<String> values) |
static boolean |
containsOnlyNonCrLfPrintableAscii(String... values)
This is useful when checking the string should be encoded into quoted-printable
or not, which is required by vCard 2.1.
|
static boolean |
containsOnlyPrintableAscii(Collection<String> values) |
static boolean |
containsOnlyPrintableAscii(String... values) |
static boolean |
containsOnlyWhiteSpaces(Collection<String> values) |
static boolean |
containsOnlyWhiteSpaces(String... values) |
static String |
convertStringCharset(String originalString,
String sourceCharset,
String targetCharset) |
static VCardParser |
getAppropriateParser(int vcardType) |
static int |
getPhoneNumberFormat(int vcardType) |
static Object |
getPhoneTypeFromStrings(Collection<String> types,
String number)
Returns Interger when the given types can be parsed as known type.
|
static String |
getPhoneTypeString(Integer type) |
static String |
getPropertyNameForIm(int protocol) |
static String |
guessImageType(byte[] input)
Guesses the format of input image.
|
static boolean |
isMobilePhoneLabel(String label) |
static boolean |
isV21Word(String value)
Returns true when the given String is categorized as "word" specified in vCard spec 2.1.
|
static boolean |
isValidInV21ButUnknownToContactsPhoteType(String label) |
static String |
parseQuotedPrintable(String value,
boolean strictLineBreaking,
String sourceCharset,
String targetCharset)
Unquotes given Quoted-Printable value. value must not be null.
|
static String[] |
sortNameElements(int nameOrder,
String familyName,
String middleName,
String givenName) |
static String |
toHalfWidthString(String orgString) |
static String |
toStringAsV30ParamValue(String value)
Returns String available as parameter value in vCard 3.0.
|
static String |
toStringAsV40ParamValue(String value) |
public static Object getPhoneTypeFromStrings(Collection<String> types, String number)
public static boolean isMobilePhoneLabel(String label)
public static boolean isValidInV21ButUnknownToContactsPhoteType(String label)
public static String getPropertyNameForIm(int protocol)
public static String[] sortNameElements(int nameOrder, String familyName, String middleName, String givenName)
public static int getPhoneNumberFormat(int vcardType)
public static String constructNameFromElements(int nameOrder, String familyName, String middleName, String givenName)
public static String constructNameFromElements(int nameOrder, String familyName, String middleName, String givenName, String prefix, String suffix)
public static List<String> constructListFromValue(String value, int vcardType)
public static boolean containsOnlyPrintableAscii(String... values)
public static boolean containsOnlyPrintableAscii(Collection<String> values)
public static boolean containsOnlyNonCrLfPrintableAscii(String... values)
This is useful when checking the string should be encoded into quoted-printable or not, which is required by vCard 2.1.
See the definition of "7bit" in vCard 2.1 spec for more information.
public static boolean containsOnlyNonCrLfPrintableAscii(Collection<String> values)
public static boolean containsOnlyAlphaDigitHyphen(String... values)
This is useful since vCard 3.0 often requires the ("X-") properties and groups should contain only alphabets, digits, and hyphen.
Note: It is already known some devices (wrongly) outputs properties with characters which should not be in the field. One example is "X-GOOGLE TALK". We accept such kind of input but must never output it unless the target is very specific to the device which is able to parse the malformed input.
public static boolean containsOnlyAlphaDigitHyphen(Collection<String> values)
public static boolean containsOnlyWhiteSpaces(String... values)
public static boolean containsOnlyWhiteSpaces(Collection<String> values)
public static boolean isV21Word(String value)
Returns true when the given String is categorized as "word" specified in vCard spec 2.1.
vCard 2.1 specifies:
word = <any printable 7bit us-ascii except []=:., >
public static String toStringAsV30ParamValue(String value)
Returns String available as parameter value in vCard 3.0.
RFC 2426 requires vCard composer to quote parameter values when it contains semi-colon, for example (See RFC 2426 for more information). This method checks whether the given String can be used without quotes.
Note: We remove DQUOTE inside the given value silently for now.
public static String guessImageType(byte[] input)
input
- Image as byte array.public static boolean areAllEmpty(String... values)
public static boolean appearsLikeAndroidVCardQuotedPrintable(String value)
public static String parseQuotedPrintable(String value, boolean strictLineBreaking, String sourceCharset, String targetCharset)
public static final VCardParser getAppropriateParser(int vcardType) throws VCardException
VCardException