Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where to find a java library to read vcard files? [closed]

Tags:

java

vcf-vcard

I need a java library to read vcard files (vcf).

like image 234
Giorgio Gelardi Avatar asked Mar 23 '09 09:03

Giorgio Gelardi


4 Answers

ez-vcard supports versions 2.1, 3.0, and 4.0 of the vCard standard, as well as XML-encoded vCards ("xCard" standard), HTML-encoded vCards ("hCard" microformat), and JSON-encoded vCards ("jCard" standard).

https://github.com/mangstadt/ez-vcard

To read a vCard file, use the Ezvcard.parse() method. Then, call the various getter methods on the returned VCard object to retrieve the vCard data fields.

File file = new File("my-vcard.vcf");
VCard vcard = Ezvcard.parse(file).first();
System.out.println("Name: " + vcard.getFormattedName().getValue());
System.out.println("Email: " + vcard.getEmails().get(0).getValue());
like image 154
Michael Avatar answered Oct 14 '22 05:10

Michael


A search for Java and vcard yields quite a few results.

In particular there's the Mime-Dir-j which is no longer under active development, but may be all you need, and vcard4j which seems to have been dormant for even longer (last release 2003!).

like image 32
Jon Skeet Avatar answered Oct 14 '22 05:10

Jon Skeet


Cardme seems to be the best vcard library around with active development and there is even a wiki site up.

Check the project homepage.

like image 29
George Avatar answered Oct 14 '22 06:10

George


Haven't used it yet (about to try it out), but this looks promising.

http://code.google.com/p/android-vcard/

like image 37
tobinibot Avatar answered Oct 14 '22 05:10

tobinibot