From 3e3f38500d8b326c03201a964c5443e30c23c5d1 Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Wed, 8 Aug 2018 03:20:37 +0800 Subject: [PATCH] Only use required memory size --- .../full/java/com/topjohnwu/magisk/asyncs/InstallMagisk.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/full/java/com/topjohnwu/magisk/asyncs/InstallMagisk.java b/app/src/full/java/com/topjohnwu/magisk/asyncs/InstallMagisk.java index 586229628..97aec05a1 100644 --- a/app/src/full/java/com/topjohnwu/magisk/asyncs/InstallMagisk.java +++ b/app/src/full/java/com/topjohnwu/magisk/asyncs/InstallMagisk.java @@ -147,7 +147,7 @@ public class InstallMagisk extends ParallelTask { 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 { } 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");