X-Git-Url: http://git.nikiroo.be/?p=jvcard.git;a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Fjvcard%2Fparsers%2FVcard21Parser.java;h=61f901606496031c6001425e3a66a138680eaa57;hp=7d0f5e86beb98e17efb7cef1c4520fef3faa798b;hb=5ad0e17e7fea1c602cb2638a006424af9c7e33e8;hpb=e4444b0bc462544629d9e7e7ab62b96a4d9cab10 diff --git a/src/be/nikiroo/jvcard/parsers/Vcard21Parser.java b/src/be/nikiroo/jvcard/parsers/Vcard21Parser.java index 7d0f5e8..61f9016 100644 --- a/src/be/nikiroo/jvcard/parsers/Vcard21Parser.java +++ b/src/be/nikiroo/jvcard/parsers/Vcard21Parser.java @@ -239,6 +239,31 @@ public class Vcard21Parser { 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. *