full solr xml exports will now be automatically compressed during

export. That makes it possible to export a solr xml dump even if disc
space is low.
pull/8/head
Michael Peter Christen 10 years ago
parent a1a8edfc0a
commit 98be59ce9c

@ -26,6 +26,7 @@ import java.io.BufferedOutputStream;
import java.io.File; import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.lang.reflect.Array; import java.lang.reflect.Array;
import java.net.MalformedURLException; import java.net.MalformedURLException;
@ -40,6 +41,7 @@ import java.util.Set;
import java.util.concurrent.BlockingQueue; import java.util.concurrent.BlockingQueue;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import java.util.zip.GZIPOutputStream;
import net.yacy.cora.date.GenericFormatter; import net.yacy.cora.date.GenericFormatter;
import net.yacy.cora.date.ISO8601Formatter; import net.yacy.cora.date.ISO8601Formatter;
@ -655,7 +657,9 @@ public final class Fulltext {
try { try {
final File parentf = this.f.getParentFile(); final File parentf = this.f.getParentFile();
if (parentf != null) parentf.mkdirs(); if (parentf != null) parentf.mkdirs();
final PrintWriter pw = new PrintWriter(new BufferedOutputStream(new FileOutputStream(this.f))); OutputStream os = new FileOutputStream(this.format == 3 ? new File(this.f.getAbsolutePath() + ".gz") : this.f);
if (this.format == 3) os = new GZIPOutputStream(os);
final PrintWriter pw = new PrintWriter(new BufferedOutputStream(os));
if (this.format == 1) { if (this.format == 1) {
pw.println("<html><head></head><body>"); pw.println("<html><head></head><body>");
} }

Loading…
Cancel
Save