VCardContactEncoder.java 文件源码

java
阅读 19 收藏 0 点赞 0 评论 0

项目:sres-app 作者:
@Override
public String[] encode(Iterable<String> names,
                       String organization,
                       Iterable<String> addresses,
                       Iterable<String> phones,
                       Iterable<String> emails,
                       String url,
                       String note) {
  StringBuilder newContents = new StringBuilder(100);
  StringBuilder newDisplayContents = new StringBuilder(100);
  newContents.append("BEGIN:VCARD").append(TERMINATOR);
  appendUpToUnique(newContents, newDisplayContents, "N", names, 1, null);
  append(newContents, newDisplayContents, "ORG", organization);
  appendUpToUnique(newContents, newDisplayContents, "ADR", addresses, 1, null);
  appendUpToUnique(newContents, newDisplayContents, "TEL", phones, Integer.MAX_VALUE, new Formatter() {
    @Override
    public String format(String source) {
      return PhoneNumberUtils.formatNumber(source);
    }
  });
  appendUpToUnique(newContents, newDisplayContents, "EMAIL", emails, Integer.MAX_VALUE, null);
  append(newContents, newDisplayContents, "URL", url);
  append(newContents, newDisplayContents, "NOTE", note);
  newContents.append("END:VCARD").append(TERMINATOR);
  return new String[] { newContents.toString(), newDisplayContents.toString() };
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号