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:
@@ -60,6 +60,8 @@ import android.text.SpannedString;
|
|||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
|
|
||||||
|
import org.tukaani.xz.XZInputStream;
|
||||||
|
|
||||||
|
|
||||||
class CountingInputStream extends BufferedInputStream
|
class CountingInputStream extends BufferedInputStream
|
||||||
{
|
{
|
||||||
@@ -498,7 +500,20 @@ class DataDownloader extends Thread
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
Log.i("SDL", "Reading from zip file '" + url + "'");
|
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("");
|
String extpath = getOutFilePath("");
|
||||||
|
|
||||||
while(true)
|
while(true)
|
||||||
|
|||||||
BIN
project/libs/xz.jar
Normal file
BIN
project/libs/xz.jar
Normal file
Binary file not shown.
Reference in New Issue
Block a user