mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Modify testSHA1() to use InputStream instead of File
This commit is contained in:
parent
d8719d4fcb
commit
03f207db16
1 changed files with 1 additions and 9 deletions
|
|
@ -45,7 +45,7 @@ public class Utils {
|
|||
|
||||
private static final String TAG = Utils.class.getName();
|
||||
|
||||
public static boolean testSHA1(String sha1, File file) {
|
||||
public static boolean testSHA1(String sha1, InputStream is) {
|
||||
MessageDigest digest;
|
||||
try {
|
||||
digest = MessageDigest.getInstance("SHA1");
|
||||
|
|
@ -54,14 +54,6 @@ public class Utils {
|
|||
return false;
|
||||
}
|
||||
|
||||
InputStream is;
|
||||
try {
|
||||
is = new FileInputStream(file);
|
||||
} catch (FileNotFoundException e) {
|
||||
Log.e(TAG, "Exception while getting FileInputStream", e);
|
||||
return false;
|
||||
}
|
||||
|
||||
byte[] buffer = new byte[8192];
|
||||
int read;
|
||||
try {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue