[[JENKINS-16301] Use a buffered input stream to get somewhat better performance also from Maven archiving.

Introducing Util.getDigestOf(File) as a convenience.
This commit is contained in:
Jesse Glick committed 2013-07-24 16:30:48 -04:00
1 parent e0a3a1ddf5
commit 11953750ab
5 files changed
+21 -12

No files matched your search

+16
View File
@@ -588,6 +588,22 @@ public class Util {
}
}
/**
* Computes the MD5 digest of a file.
* @param file a file
* @return a 32-character string
* @throws IOException in case reading fails
* @since 1.525
*/
public static String getDigestOf(File file) throws IOException {
InputStream is = new FileInputStream(file);
try {
return getDigestOf(new BufferedInputStream(is));
} finally {
is.close();
}
}
/**
* Converts a string into 128-bit AES key.
* @since 1.308