From 80cabb338b0f02a2b757adb5fd370d45ec2fb052 Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Fri, 1 Dec 2017 11:42:05 +0800 Subject: [PATCH] Java has native inputstream wrapper --- .../magisk/asyncs/ProcessRepoZip.java | 4 +- .../magisk/container/InputStreamWrapper.java | 74 ------------------- 2 files changed, 2 insertions(+), 76 deletions(-) delete mode 100644 app/src/main/java/com/topjohnwu/magisk/container/InputStreamWrapper.java diff --git a/app/src/main/java/com/topjohnwu/magisk/asyncs/ProcessRepoZip.java b/app/src/main/java/com/topjohnwu/magisk/asyncs/ProcessRepoZip.java index 2fdf344e9..c4196ea80 100644 --- a/app/src/main/java/com/topjohnwu/magisk/asyncs/ProcessRepoZip.java +++ b/app/src/main/java/com/topjohnwu/magisk/asyncs/ProcessRepoZip.java @@ -12,7 +12,6 @@ import android.widget.Toast; import com.topjohnwu.magisk.FlashActivity; import com.topjohnwu.magisk.MagiskManager; import com.topjohnwu.magisk.R; -import com.topjohnwu.magisk.container.InputStreamWrapper; import com.topjohnwu.magisk.utils.Const; import com.topjohnwu.magisk.utils.Shell; import com.topjohnwu.magisk.utils.Utils; @@ -24,6 +23,7 @@ import java.io.BufferedOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; +import java.io.FilterInputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; @@ -167,7 +167,7 @@ public class ProcessRepoZip extends ParallelTask { return this; } - private class ProgressInputStream extends InputStreamWrapper { + private class ProgressInputStream extends FilterInputStream { ProgressInputStream(InputStream in) { super(in); diff --git a/app/src/main/java/com/topjohnwu/magisk/container/InputStreamWrapper.java b/app/src/main/java/com/topjohnwu/magisk/container/InputStreamWrapper.java deleted file mode 100644 index 020d823b7..000000000 --- a/app/src/main/java/com/topjohnwu/magisk/container/InputStreamWrapper.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.topjohnwu.magisk.container; - -import android.support.annotation.NonNull; - -import java.io.IOException; -import java.io.InputStream; - -public class InputStreamWrapper extends InputStream { - private InputStream in; - - public InputStreamWrapper(InputStream in) { - this.in = in; - } - - @Override - public int available() throws IOException { - return in.available(); - } - - @Override - public void close() throws IOException { - in.close(); - } - - @Override - public synchronized void mark(int readlimit) { - in.mark(readlimit); - } - - @Override - public boolean markSupported() { - return in.markSupported(); - } - - @Override - public synchronized int read() throws IOException { - return in.read(); - } - - @Override - public int read(@NonNull byte[] b) throws IOException { - return in.read(b); - } - - @Override - public synchronized int read(@NonNull byte[] b, int off, int len) throws IOException { - return in.read(b, off, len); - } - - @Override - public synchronized void reset() throws IOException { - in.reset(); - } - - @Override - public long skip(long n) throws IOException { - return in.skip(n); - } - - @Override - public int hashCode() { - return in.hashCode(); - } - - @Override - public boolean equals(Object obj) { - return in.equals(obj); - } - - @Override - public String toString() { - return in.toString(); - } -}