From 9b617bcb65254bda50f0c04e41ca82302bc68e3b Mon Sep 17 00:00:00 2001 From: hydrox Date: Sat, 17 Dec 2005 21:19:51 +0000 Subject: [PATCH] *)compression of -domlist now optional (-format zip git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@1230 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- source/yacy.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/source/yacy.java b/source/yacy.java index 593d5c546..7f5e7fdf4 100644 --- a/source/yacy.java +++ b/source/yacy.java @@ -1104,7 +1104,7 @@ public final class yacy { } } - private static void domlist(String homePath, boolean html, String targetName) { + private static void domlist(String homePath, String format, String targetName) { File root = new File(homePath); try { plasmaURLPool pool = new plasmaURLPool(new File(root, "DATA/PLASMADB"), 16000, 1000, 1000); @@ -1117,7 +1117,7 @@ public final class yacy { } // output file - if (html) { + if (format.equals("html")) { File file = new File(root, targetName + ".html"); BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(file)); Iterator i = doms.iterator(); @@ -1128,7 +1128,7 @@ public final class yacy { bos.write(serverCore.crlf); } bos.close(); - } else { + } else if (format.equals("zip")) { ZipEntry zipEntry = new ZipEntry(targetName + ".txt"); File file = new File(root, targetName + ".zip"); ZipOutputStream bos = new ZipOutputStream(new FileOutputStream(file)); @@ -1142,6 +1142,10 @@ public final class yacy { } bos.close(); } + else { + // plain text list + serverFileUtils.saveSet(new File(root, targetName + ".txt"), doms, new String(serverCore.crlf)); + } pool.close(); } catch (IOException e) { e.printStackTrace(); @@ -1337,14 +1341,15 @@ public final class yacy { transferCR(targetaddress, crfile); } else if ((args.length >= 1) && (args[0].equals("-domlist"))) { // generate a url list and save it in a file - boolean html = false; + String format = "txt"; if (args.length >= 3 && args[1].equals("-format")) { - if (args[2].equals("html")) html = true; + if (args[2].equals("html")) format = args[2]; + if (args[2].equals("zip")) format = args[2]; args = shift(args, 1, 2); } if (args.length == 2) applicationRoot= args[1]; String outfile = "domlist_" + System.currentTimeMillis(); - domlist(applicationRoot, html, outfile); + domlist(applicationRoot, format, outfile); } else if ((args.length >= 1) && (args[0].equals("-urllist"))) { // generate a url list and save it in a file boolean html = false;