Remote support ~complete (need more tests at least)
[jvcard.git] / src / be / nikiroo / jvcard / parsers / Vcard21Parser.java
index 7d0f5e86beb98e17efb7cef1c4520fef3faa798b..61f901606496031c6001425e3a66a138680eaa57 100644 (file)
@@ -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.
         *