Skip to content

Commit

Permalink
*)compression of -domlist now optional (-format zip
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@1230 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
hydrox committed Dec 17, 2005
1 parent 2bd4a66 commit 9b617bc
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions source/yacy.java
Expand Up @@ -1104,7 +1104,7 @@ private static void transferCR(String targetaddress, String crfile) {
}
}

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);
Expand All @@ -1117,7 +1117,7 @@ private static void domlist(String homePath, boolean html, String targetName) {
}

// 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();
Expand All @@ -1128,7 +1128,7 @@ private static void domlist(String homePath, boolean html, String targetName) {
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));
Expand All @@ -1142,6 +1142,10 @@ private static void domlist(String homePath, boolean html, String targetName) {
}
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();
Expand Down Expand Up @@ -1337,14 +1341,15 @@ public static void main(String args[]) {
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;
Expand Down

0 comments on commit 9b617bc

Please sign in to comment.