在哪里可以找到读取 vcard 文件的 Java 库?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/672704/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-29 13:19:35  来源:igfitidea点击:

Where to find a java library to read vcard files?

javavcard

提问by Giorgio Gelardi

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

我需要一个 java 库来读取 vcard 文件 (vcf)。

采纳答案by Jon Skeet

A search for Java and vcardyields quite a few results.

一个用于Java和电子名片搜索产生了不少成果。

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

特别是Mime-Dir-j不再处于积极开发状态,但可能是您所需要的,而vcard4j似乎已经休眠了更长时间(2003 年最新版本!)。

回答by Michael

ez-vcardsupports 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).

ez-vcard支持 vCard 标准的 2.1、3.0 和 4.0 版,以及 XML 编码的 vCard(“xCard”标准)、HTML 编码的 vCard(“hCard”微格式)和 JSON 编码的 vCard(“jCard”标准)。

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

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 VCardobject to retrieve the vCard data fields.

要读取 vCard 文件,请使用Ezvcard.parse()方法。然后,对返回的VCard对象调用各种 getter 方法以检索 vCard 数据字段。

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());

回答by George

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

Cardme似乎是最好的 vcard 库,开发积极,甚至还有一个 wiki 站点。

Check the project homepage.

检查项目主页

回答by tobinibot

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

还没有使用它(即将尝试),但这看起来很有希望。

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

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

回答by Mario Ortegón

I found this API that might do the trick: http://sourceforge.net/projects/mime-dir-j/

我发现这个 API 可以解决这个问题:http: //sourceforge.net/projects/mime-dir-j/

回答by guerda

Try Google, Yahoo, whatever and find http://vcard4j.sourceforge.net/

试试谷歌,雅虎,随便找个http://vcard4j.sourceforge.net/

回答by michael aubert

Well, just in case you want to use a mobile phone, JSR75 does it right out of the box:

好吧,万一您想使用手机,JSR75 开箱即用:

javax.microedition.pim.PIM.fromSerialFormat is specified as supporting vCard 3.0

javax.microedition.pim.PIM.fromSerialFormat 被指定为支持 vCard 3.0