it.cnr.iit.jscontact.tools.vcard.extensions.utils.VCardParser Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jscontact-tools Show documentation
Show all versions of jscontact-tools Show documentation
Java tools for JSContact building, validation, serialization/deserialization and conversion from vCard 4.0 (RFC6350) and its transliterations, namely xCard (RFC6351) and jCard (RFC7095).
package it.cnr.iit.jscontact.tools.vcard.extensions.utils;
import ezvcard.Ezvcard;
import ezvcard.VCard;
import it.cnr.iit.jscontact.tools.vcard.extensions.io.scribe.ExtendedAddressScribe;
import it.cnr.iit.jscontact.tools.vcard.extensions.io.scribe.ExtendedStructuredNameScribe;
import java.io.File;
import java.io.IOException;
import java.io.Reader;
import java.util.List;
public class VCardParser {
public static List parse(String str) {
return Ezvcard.parse(str)
.caretDecoding(true)
.register(new ExtendedAddressScribe())
.register(new ExtendedStructuredNameScribe())
.all();
}
public static List parse(File file) throws IOException {
return Ezvcard.parse(file)
.caretDecoding(true)
.register(new ExtendedAddressScribe())
.register(new ExtendedStructuredNameScribe())
.all();
}
public static List parse(Reader reader) throws IOException {
return Ezvcard.parse(reader)
.caretDecoding(true)
.register(new ExtendedAddressScribe())
.register(new ExtendedStructuredNameScribe())
.all();
}
public static List parseJson(String str) {
return Ezvcard.parseJson(str)
.register(new ExtendedAddressScribe())
.register(new ExtendedStructuredNameScribe())
.all();
}
public static List parseJson(File file) throws IOException {
return Ezvcard.parseJson(file)
.register(new ExtendedAddressScribe())
.register(new ExtendedStructuredNameScribe())
.all();
}
public static List parseJson(Reader reader) throws IOException {
return Ezvcard.parseJson(reader)
.register(new ExtendedAddressScribe())
.register(new ExtendedStructuredNameScribe())
.all();
}
public static List parseXml(String str) {
return Ezvcard.parseXml(str)
.register(new ExtendedAddressScribe())
.register(new ExtendedStructuredNameScribe())
.all();
}
public static List parseXml(File file) throws IOException {
return Ezvcard.parseXml(file)
.register(new ExtendedAddressScribe())
.register(new ExtendedStructuredNameScribe())
.all();
}
public static List parseXml(Reader reader) throws IOException {
return Ezvcard.parseXml(reader)
.register(new ExtendedAddressScribe())
.register(new ExtendedStructuredNameScribe())
.all();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy