public static void verifySavedMD5 ( File dataFile , MD5Hash expectedMD5 ) throws IOException { MD5Hash storedHash = readStoredMd5ForFile ( dataFile ) ; // Check the hash itself if ( ! expectedMD5 . equals ( storedHash ) ) { throw new IOException ( "File " + dataFile + " did not match stored MD5 checksum " + " (stored: " + storedHash + ", computed: " + expectedMD5 ) ; } }
Verify that the previously saved md5 for the given file matches expectedMd5 .