Commit 3e3f3850 authored by topjohnwu's avatar topjohnwu

Only use required memory size

parent 5109b9ab
...@@ -147,7 +147,7 @@ public class InstallMagisk extends ParallelTask<Void, Void, Boolean> { ...@@ -147,7 +147,7 @@ public class InstallMagisk extends ParallelTask<Void, Void, Boolean> {
console.add("- Downloading zip"); console.add("- Downloading zip");
HttpURLConnection conn = WebService.mustRequest(Data.magiskLink, null); HttpURLConnection conn = WebService.mustRequest(Data.magiskLink, null);
buf = new BufferedInputStream(new ProgressStream(conn), conn.getContentLength()); buf = new BufferedInputStream(new ProgressStream(conn), conn.getContentLength());
buf.mark(Integer.MAX_VALUE); buf.mark(conn.getContentLength());
try (OutputStream out = new FileOutputStream(zip)) { try (OutputStream out = new FileOutputStream(zip)) {
ShellUtils.pump(buf, out); ShellUtils.pump(buf, out);
} }
...@@ -156,7 +156,7 @@ public class InstallMagisk extends ParallelTask<Void, Void, Boolean> { ...@@ -156,7 +156,7 @@ public class InstallMagisk extends ParallelTask<Void, Void, Boolean> {
} else { } else {
console.add("- Existing zip found"); console.add("- Existing zip found");
buf = new BufferedInputStream(new FileInputStream(zip), (int) zip.length()); buf = new BufferedInputStream(new FileInputStream(zip), (int) zip.length());
buf.mark(Integer.MAX_VALUE); buf.mark((int) zip.length());
} }
console.add("- Extracting files"); console.add("- Extracting files");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment