提交 bc763c86 authored 作者: Thomas Mueller's avatar Thomas Mueller

Archive tool: faster compression, add documentation

上级 fcad7590
...@@ -31,6 +31,10 @@ import java.util.zip.InflaterInputStream; ...@@ -31,6 +31,10 @@ import java.util.zip.InflaterInputStream;
/** /**
* A standalone archive tool to compress directories. It does not have any * A standalone archive tool to compress directories. It does not have any
* dependencies except for the Java libraries. * dependencies except for the Java libraries.
* <p>
* Unlike other compression tools, it splits the data into chunks and sorts the
* chunks, so that large directories or files that contain duplicate data are
* compressed much better.
*/ */
public class ArchiveTool { public class ArchiveTool {
...@@ -98,7 +102,7 @@ public class ArchiveTool { ...@@ -98,7 +102,7 @@ public class ArchiveTool {
new BufferedOutputStream( new BufferedOutputStream(
new FileOutputStream(toFile), 32 * 1024); new FileOutputStream(toFile), 32 * 1024);
Deflater def = new Deflater(); Deflater def = new Deflater();
// def.setLevel(Deflater.BEST_SPEED); def.setLevel(Deflater.BEST_SPEED);
out = new BufferedOutputStream( out = new BufferedOutputStream(
new DeflaterOutputStream(out, def)); new DeflaterOutputStream(out, def));
sort(in, out, temp, size); sort(in, out, temp, size);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论