本文整理汇总了Java中net.sourceforge.cardme.engine.VCardEngine类的典型用法代码示例。如果您正苦于以下问题:Java VCardEngine类的具体用法?Java VCardEngine怎么用?Java VCardEngine使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
VCardEngine类属于net.sourceforge.cardme.engine包,在下文中一共展示了VCardEngine类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readDetailsFromvCard
import net.sourceforge.cardme.engine.VCardEngine; //导入依赖的package包/类
/**
* Parses the details from the specified vCard string and adds them to the right
* details lists.
*
* @param vCardEngine The vCard parsing engine to use
* @param vCardString The vCard contents as a string
* @param names The "formatted names" list
* @param emails The "email addresses" list
* @param organizations The "organization names" list
* @param titles The "titles" list
*
* @throws IOException Thrown if the vCard string is malformed
*/
private static void readDetailsFromvCard(VCardEngine vCardEngine, String vCardString, ArrayList<String> names,
ArrayList<String> emails, ArrayList<String> organizations,
ArrayList<String> titles) throws IOException {
String tmp;
VCard vCard = vCardEngine.parse(vCardString);
// Read the formatted name and title from the vCard first
if (vCard.getFormattedName() != null) {
tmp = vCard.getFormattedName().getFormattedName();
names.add(tmp);
if (DEBUG) Log.v(TAG, "Tag formatted name: " + tmp);
}
if (vCard.getTitle() != null) {
tmp = vCard.getTitle().getTitle();
titles.add(tmp);
if (DEBUG) Log.v(TAG, "Tag title: " + tmp);
}
// Read the emails and organizations (there can be more than one per vCard)
if (vCard.getEmails() != null) {
final Iterator<EmailFeature> emailIterator = vCard.getEmails();
while (emailIterator.hasNext()) {
tmp = emailIterator.next().getEmail();
emails.add(tmp);
if (DEBUG) Log.v(TAG, "Tag email: " + tmp);
}
}
if (vCard.getOrganizations() != null && vCard.getOrganizations().getOrganizations() != null) {
final Iterator<String> orgsIterator = vCard.getOrganizations().getOrganizations();
while (orgsIterator.hasNext()) {
tmp = orgsIterator.next();
organizations.add(tmp);
if (DEBUG) Log.v(TAG, "Tag organization: " + tmp);
}
}
}
示例2: VCarder
import net.sourceforge.cardme.engine.VCardEngine; //导入依赖的package包/类
public VCarder() {
vcardEngine = new VCardEngine();
vcard = new VCardImpl();
writer = new VCardWriter();
}