Update on remote-server
[jvcard.git] / src / be / nikiroo / jvcard / parsers / Parser.java
index 5cdd25fee995dfe10aef8c6d4a5d00dcc18aa5ab..ceb35dccca75de055917b4050b5df3f912110fb3 100644 (file)
@@ -28,7 +28,7 @@ public class Parser {
         * @throws IOException
         *             in case of IO error
         */
-       public static List<Contact> parse(File file, Format format)
+       public static List<Contact> parseContact(File file, Format format)
                        throws IOException {
                List<String> lines = null;
 
@@ -46,7 +46,7 @@ public class Parser {
                if (lines == null)
                        return new LinkedList<Contact>();
 
-               return parse(lines, format);
+               return parseContact(lines, format);
        }
 
        /**
@@ -59,12 +59,12 @@ public class Parser {
         * 
         * @return the list of elements
         */
-       public static List<Contact> parse(List<String> lines, Format format) {
+       public static List<Contact> parseContact(List<String> lines, Format format) {
                switch (format) {
                case VCard21:
-                       return Vcard21Parser.parse(lines);
+                       return Vcard21Parser.parseContact(lines);
                case Abook:
-                       return AbookParser.parse(lines);
+                       return AbookParser.parseContact(lines);
 
                default:
                        throw new InvalidParameterException("Unknown format: "
@@ -72,13 +72,24 @@ public class Parser {
                }
        }
 
-       // -1 = no bkeys
-       public static String toString(Card card, Format format) {
+       /**
+        * Return a {@link String} representation of the given {@link Card}, line by
+        * line.
+        * 
+        * @param card
+        *            the card to convert
+        * 
+        * @param format
+        *            the output {@link Format} to use
+        * 
+        * @return the {@link String} representation
+        */
+       public static List<String> toStrings(Card card, Format format) {
                switch (format) {
                case VCard21:
-                       return Vcard21Parser.toString(card);
+                       return Vcard21Parser.toStrings(card);
                case Abook:
-                       return AbookParser.toString(card);
+                       return AbookParser.toStrings(card);
 
                default:
                        throw new InvalidParameterException("Unknown format: "
@@ -86,14 +97,29 @@ public class Parser {
                }
        }
 
-       // -1 = no bkeys
-       public static String toString(Contact contact, Format format,
+       /**
+        * Return a {@link String} representation of the given {@link Card}, line by
+        * line.
+        * 
+        * @param card
+        *            the card to convert
+        * 
+        * @param startingBKey
+        *            the starting BKey number (all the other will follow) or -1 for
+        *            no BKey
+        * 
+        * @param format
+        *            the output {@link Format} to use
+        * 
+        * @return the {@link String} representation
+        */
+       public static List<String> toStrings(Contact contact, Format format,
                        int startingBKey) {
                switch (format) {
                case VCard21:
-                       return Vcard21Parser.toString(contact, startingBKey);
+                       return Vcard21Parser.toStrings(contact, startingBKey);
                case Abook:
-                       return AbookParser.toString(contact, startingBKey);
+                       return AbookParser.toStrings(contact, startingBKey);
 
                default:
                        throw new InvalidParameterException("Unknown format: "