Some refinements

This commit is contained in:
topjohnwu
2016-11-23 22:38:15 +08:00
parent 3b20747192
commit 4daea7d7e6
6 changed files with 86 additions and 71 deletions
@@ -14,6 +14,8 @@ import android.widget.Toast;
import com.topjohnwu.magisk.R;
import com.topjohnwu.magisk.receivers.DownloadReceiver;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.UnsupportedEncodingException;
import java.security.InvalidKeyException;
@@ -136,4 +138,17 @@ public class Utils {
.replace("#", "").replace("@", "").replace("*", "");
}
public static class ByteArrayInOutStream extends ByteArrayOutputStream {
public ByteArrayInputStream getInputStream() {
ByteArrayInputStream in = new ByteArrayInputStream(buf, 0, count);
count = 0;
buf = new byte[32];
return in;
}
public void setBuffer(byte[] buffer) {
buf = buffer;
count = buffer.length;
}
}
}