Jar merging + reformat

This commit is contained in:
modmuss50
2016-08-17 17:38:54 +01:00
parent c03f842227
commit 65e2a76d70
21 changed files with 980 additions and 924 deletions

View File

@@ -32,20 +32,20 @@ import java.io.File;
import java.io.IOException;
public class Checksum {
public static boolean equals(File file, String checksum) {
if (file == null) {
return false;
}
try {
HashCode hash = Files.hash(file, Hashing.sha1());
StringBuilder builder = new StringBuilder();
for (Byte hashBytes : hash.asBytes()) {
builder.append(Integer.toString((hashBytes & 0xFF) + 0x100, 16).substring(1));
}
return builder.toString().equals(checksum);
} catch (IOException e) {
e.printStackTrace();
}
return false;
}
public static boolean equals(File file, String checksum) {
if (file == null) {
return false;
}
try {
HashCode hash = Files.hash(file, Hashing.sha1());
StringBuilder builder = new StringBuilder();
for (Byte hashBytes : hash.asBytes()) {
builder.append(Integer.toString((hashBytes & 0xFF) + 0x100, 16).substring(1));
}
return builder.toString().equals(checksum);
} catch (IOException e) {
e.printStackTrace();
}
return false;
}
}