Slightly simplify declarations in Utils.java

This commit is contained in:
Daniel Martí 2015-04-21 17:33:52 +02:00
parent b84e8ef7d6
commit ec4b2bf331

View File

@ -148,11 +148,9 @@ public final class Utils {
} }
public static boolean copy(File inFile, File outFile) { public static boolean copy(File inFile, File outFile) {
InputStream input;
OutputStream output;
try { try {
input = new FileInputStream(inFile); InputStream input = new FileInputStream(inFile);
output = new FileOutputStream(outFile); OutputStream output = new FileOutputStream(outFile);
Utils.copy(input, output); Utils.copy(input, output);
output.close(); output.close();
input.close(); input.close();
@ -473,15 +471,13 @@ public final class Utils {
public static String getBinaryHash(File apk, String algo) { public static String getBinaryHash(File apk, String algo) {
FileInputStream fis = null; FileInputStream fis = null;
BufferedInputStream bis;
try { try {
MessageDigest md = MessageDigest.getInstance(algo); MessageDigest md = MessageDigest.getInstance(algo);
fis = new FileInputStream(apk); fis = new FileInputStream(apk);
bis = new BufferedInputStream(fis); BufferedInputStream bis = new BufferedInputStream(fis);
byte[] dataBytes = new byte[524288]; byte[] dataBytes = new byte[524288];
int nread; int nread;
while ((nread = bis.read(dataBytes)) != -1) while ((nread = bis.read(dataBytes)) != -1)
md.update(dataBytes, 0, nread); md.update(dataBytes, 0, nread);