X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Fjvcard%2Fparsers%2FAbookParser.java;h=17080225b34cc5d9fa9cbc7c1a58fd69b5da8d6c;hb=812124d18d08bfc270adab0cd1e289dc6126563b;hp=b8e6e58e47c2187acf5fd80e8b3c046acacf6d33;hpb=59597d59aa262e31c2e1b7f66b4cb299f88ebd1b;p=jvcard.git diff --git a/src/be/nikiroo/jvcard/parsers/AbookParser.java b/src/be/nikiroo/jvcard/parsers/AbookParser.java index b8e6e58..1708022 100644 --- a/src/be/nikiroo/jvcard/parsers/AbookParser.java +++ b/src/be/nikiroo/jvcard/parsers/AbookParser.java @@ -58,11 +58,12 @@ public class AbookParser { * * @param startingBKey * the starting BKey number (all the other will follow) or -1 for - * no BKey + * no BKey (it is actually not used in this mode) * * @return the {@link String} representation */ - public static List toStrings(Contact contact, int startingBKey) { + public static List toStrings(Contact contact, + @SuppressWarnings("unused") int startingBKey) { // BKey is not used in pine mode StringBuilder builder = new StringBuilder(); @@ -109,10 +110,13 @@ public class AbookParser { builder.append(notes); } + // abook format = one line per contact + String out = builder.toString().replace("\n", "\\n"); + // note: save as pine means normal LN, nor CRLN - builder.append('\n'); + out = out + "\n"; - return Arrays.asList(new String[] { builder.toString() }); + return Arrays.asList(new String[] { out }); } /** @@ -152,7 +156,6 @@ public class AbookParser { int startingBKey) throws IOException { for (String s : toStrings(contact, startingBKey)) { writer.append(s); - writer.append('\n'); } } @@ -170,7 +173,6 @@ public class AbookParser { public static void write(Appendable writer, Card card) throws IOException { for (String s : toStrings(card)) { writer.append(s); - writer.append('\n'); } } }