]> gitweb.fperrin.net Git - DictionaryPC.git/commitdiff
Compress WiktionarySplitter output files.
authorReimar Döffinger <Reimar.Doeffinger@gmx.de>
Sun, 15 Oct 2017 13:21:12 +0000 (15:21 +0200)
committerReimar Döffinger <Reimar.Doeffinger@gmx.de>
Sun, 15 Oct 2017 13:21:12 +0000 (15:21 +0200)
Saves around 60% of disk space with no significant
difference in speed on a multi-core system.

src/com/hughes/android/dictionary/engine/WiktionarySplitter.java

index 097643f1af7e3762cb1d76b16e0a44c4e0f3e240..0624025387b7f134242de98736ec4082e4915029 100644 (file)
@@ -83,7 +83,9 @@ public class WiktionarySplitter extends org.xml.sax.helpers.DefaultHandler {
             currentSelectors = pathToSelectorsEntry.getValue();
 
             for (final Selector selector : currentSelectors) {
-                OutputStream tmp = new FileOutputStream(selector.outFilename);
+                OutputStream tmp = new FileOutputStream(selector.outFilename + ".gz");
+                tmp = new BufferedOutputStream(tmp);
+                tmp = new CompressorStreamFactory().createCompressorOutputStream(CompressorStreamFactory.GZIP, tmp);
                 tmp = new WriteBuffer(tmp, 20 * 1024 * 1024);
                 selector.out = new DataOutputStream(tmp);
             }