1
mirror of https://github.com/topjohnwu/Magisk synced 2024-11-13 20:54:12 +01:00

Only use required memory size

This commit is contained in:
topjohnwu 2018-08-08 03:20:37 +08:00
parent 5109b9abfd
commit 3e3f38500d

View File

@ -147,7 +147,7 @@ public class InstallMagisk extends ParallelTask<Void, Void, Boolean> {
console.add("- Downloading zip");
HttpURLConnection conn = WebService.mustRequest(Data.magiskLink, null);
buf = new BufferedInputStream(new ProgressStream(conn), conn.getContentLength());
buf.mark(Integer.MAX_VALUE);
buf.mark(conn.getContentLength());
try (OutputStream out = new FileOutputStream(zip)) {
ShellUtils.pump(buf, out);
}
@ -156,7 +156,7 @@ public class InstallMagisk extends ParallelTask<Void, Void, Boolean> {
} else {
console.add("- Existing zip found");
buf = new BufferedInputStream(new FileInputStream(zip), (int) zip.length());
buf.mark(Integer.MAX_VALUE);
buf.mark((int) zip.length());
}
console.add("- Extracting files");