diff --git a/source/net/yacy/cora/protocol/http/GzipCompressingEntity.java b/source/net/yacy/cora/protocol/http/GzipCompressingEntity.java index 19e4bdfa0..01c78337e 100644 --- a/source/net/yacy/cora/protocol/http/GzipCompressingEntity.java +++ b/source/net/yacy/cora/protocol/http/GzipCompressingEntity.java @@ -27,6 +27,7 @@ package net.yacy.cora.protocol.http; import java.io.IOException; import java.io.OutputStream; +import java.util.zip.Deflater; import java.util.zip.GZIPOutputStream; import org.apache.http.Header; @@ -65,7 +66,7 @@ public class GzipCompressingEntity extends HttpEntityWrapper { if (outstream == null) { throw new IllegalArgumentException("Output stream may not be null"); } - GZIPOutputStream gzip = new GZIPOutputStream(outstream); + GZIPOutputStream gzip = new GZIPOutputStream(outstream, 65536){{def.setLevel(Deflater.BEST_SPEED);}}; wrappedEntity.writeTo(gzip); gzip.finish(); } diff --git a/source/net/yacy/kelondro/blob/Compressor.java b/source/net/yacy/kelondro/blob/Compressor.java index 8da99e5a9..73fc52b05 100644 --- a/source/net/yacy/kelondro/blob/Compressor.java +++ b/source/net/yacy/kelondro/blob/Compressor.java @@ -35,6 +35,7 @@ import java.io.OutputStream; import java.util.Iterator; import java.util.Map; import java.util.TreeMap; +import java.util.zip.Deflater; import java.util.zip.GZIPInputStream; import java.util.zip.GZIPOutputStream; @@ -114,7 +115,7 @@ public class Compressor implements BLOB, Iterable { //System.out.print("/(" + cdr + ")"); // DEBUG final ByteArrayOutputStream baos = new ByteArrayOutputStream(b.length / 5); baos.write(gzipMagic); - final OutputStream os = new GZIPOutputStream(baos, 512); + final OutputStream os = new GZIPOutputStream(baos, 65536){{def.setLevel(Deflater.BEST_COMPRESSION);}}; os.write(b); os.close(); baos.close(); diff --git a/source/net/yacy/kelondro/index/RowHandleMap.java b/source/net/yacy/kelondro/index/RowHandleMap.java index 9689bdc1e..3a29c7735 100644 --- a/source/net/yacy/kelondro/index/RowHandleMap.java +++ b/source/net/yacy/kelondro/index/RowHandleMap.java @@ -45,6 +45,7 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; import java.util.concurrent.LinkedBlockingQueue; +import java.util.zip.Deflater; import java.util.zip.GZIPInputStream; import java.util.zip.GZIPOutputStream; @@ -189,7 +190,7 @@ public final class RowHandleMap implements HandleMap, Iterable"); diff --git a/source/net/yacy/utils/gzip.java b/source/net/yacy/utils/gzip.java index 2a387cf3b..c7360bcec 100644 --- a/source/net/yacy/utils/gzip.java +++ b/source/net/yacy/utils/gzip.java @@ -35,6 +35,7 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import java.util.zip.Deflater; import java.util.zip.GZIPInputStream; import java.util.zip.GZIPOutputStream; @@ -49,7 +50,7 @@ public class gzip { public static void gzipFile(final String inFile, final String outFile) { try { final InputStream fin = new BufferedInputStream(new FileInputStream(inFile)); - final OutputStream fout = new GZIPOutputStream(new BufferedOutputStream(new FileOutputStream(outFile), 1024)); + final OutputStream fout = new GZIPOutputStream(new BufferedOutputStream(new FileOutputStream(outFile)), 65536){{def.setLevel(Deflater.BEST_COMPRESSION);}}; copy(fout, fin, 1024); fin.close(); fout.close(); @@ -87,7 +88,7 @@ public class gzip { final InputStream fin = new ByteArrayInputStream(in.getBytes("UTF8")); final int buffersize = Math.min(1024, in.length()); final ByteArrayOutputStream baos = new ByteArrayOutputStream(buffersize); - final OutputStream fout = new GZIPOutputStream(baos, Math.max(buffersize, 512)); + final OutputStream fout = new GZIPOutputStream(baos, Math.max(buffersize, 65536)){{def.setLevel(Deflater.BEST_COMPRESSION);}}; copy(fout, fin, 1024); fin.close(); fout.close(); @@ -123,7 +124,7 @@ public class gzip { java.util.zip.GZIPOutputStream gzipout = null; try { f.getParentFile().mkdirs(); - gzipout = new java.util.zip.GZIPOutputStream(new FileOutputStream(f)); + gzipout = new java.util.zip.GZIPOutputStream(new FileOutputStream(f), 65536){{def.setLevel(Deflater.BEST_COMPRESSION);}}; gzipout.write(content, 0, content.length); } finally { if (gzipout!=null)try{gzipout.close();}catch(final Exception e){}