Added support for .tar.xz compression format for data downloader,

xz gives 30% better compression than plain zip, but you need to
create zip archive with no compression: zip -0 -r, then
compress it with xz: xz -8 < archive.zip > archive.zip.xz
Data downloader will try to use xz decompressor on
anything with extension .zip.xz
This commit is contained in:
Sergii Pylypenko
2014-08-19 21:59:00 +03:00
parent b5743e65a0
commit cdf5d869bb
2 changed files with 16 additions and 1 deletions

View File

@@ -60,6 +60,8 @@ import android.text.SpannedString;
import android.app.AlertDialog;
import android.content.DialogInterface;
import org.tukaani.xz.XZInputStream;
class CountingInputStream extends BufferedInputStream
{
@@ -498,7 +500,20 @@ class DataDownloader extends Thread
else
{
Log.i("SDL", "Reading from zip file '" + url + "'");
ZipInputStream zip = new ZipInputStream(stream);
ZipInputStream zip;
if (url.endsWith(".zip.xz") || url.endsWith(".zip.xz/download"))
try
{
zip = new ZipInputStream(new XZInputStream(stream));
}
catch (Exception eeeee)
{
Log.i("SDL", "Opening file '" + url + "' failed - cannot open XZ input stream: " + eeeee.toString());
return false;
}
else
zip = new ZipInputStream(stream);
String extpath = getOutFilePath("");
while(true)