dataBuilder.append(type.getName());
if (type.getValue() != null && !type.getValue().trim().equals("")) {
dataBuilder.append('=');
- dataBuilder.append(type.getValue());
+ dataBuilder.append(type.getRawValue());
}
}
dataBuilder.append(':');
// TODO: bkey!
- dataBuilder.append(data.getValue());
+ dataBuilder.append(data.getRawValue());
// RFC says: Content lines SHOULD be folded to a maximum width of 75
// octets -> since it is SHOULD, we will just cut it as 74/75 chars
return lines;
}
+ /**
+ * Clone the given {@link Card} by exporting then importing it again in VCF.
+ *
+ * @param c
+ * the {@link Card} to clone
+ *
+ * @return the clone {@link Contact}
+ */
+ public static Card clone(Card c) {
+ return new Card(parseContact(toStrings(c)));
+ }
+
+ /**
+ * Clone the given {@link Contact} by exporting then importing it again in
+ * VCF.
+ *
+ * @param c
+ * the {@link Contact} to clone
+ *
+ * @return the clone {@link Contact}
+ */
+ public static Contact clone(Contact c) {
+ return parseContact(toStrings(c, -1)).get(0);
+ }
+
/**
* Check if the given line is a continuation line or not.
*