// testParser.setCompatibilityMode(CompatibilityMode.MS_OUTLOOK);
// List<VCard> vcards = testParser.importVCards();
List<VCard> vcards = testParser.importVCardsMultiple();
VCardWriter writer = new VCardWriter();
writer.setOutputVersion(VCardVersion.V3_0);
// writer.setCompatibilityMode(CompatibilityMode.MAC_ADDRESS_BOOK);
// writer.setFoldingScheme(FoldingScheme.MAC_ADDRESS_BOOK);
// writer.setBinaryfoldingScheme(BinaryFoldingScheme.MAC_ADDRESS_BOOK);
// writer.setEOL(VCardUtils.LF);
// writer.setCompatibilityMode(CompatibilityMode.MS_OUTLOOK);
// writer.setCompatibilityMode(CompatibilityMode.I_PHONE);
writer.setCompatibilityMode(CompatibilityMode.RFC2426);
writer.setFoldingScheme(FoldingScheme.MIME_DIR);
writer.setBinaryfoldingScheme(BinaryFoldingScheme.MIME_DIR);
for(int i = 0; i < vcards.size(); i++) {
VCardImpl vcard = (VCardImpl)vcards.get(i);
if(vcard.hasErrors()) {
System.out.println("VCard "+i+" has some errors ...");
List<VCardError> errors = vcard.getErrors();
for(int j = 0; j < errors.size(); j++) {
System.out.println(errors.get(j).getErrorMessage());
System.out.println(errors.get(j).getSeverity());
System.out.println(StringUtil.formatException(errors.get(j).getError()));
}
}
writer.setVCard(vcard);
String vstring = writer.buildVCardString();
if(writer.hasErrors()) {
List<VCardError> errors = vcard.getErrors();
for(int j = 0; j < errors.size(); j++) {
System.out.println(errors.get(j).getErrorMessage());
System.out.println(errors.get(j).getSeverity());
System.out.println(StringUtil.formatException(errors.get(j).getError()));