code: public static MD5Hash readStoredMd5ForFile(File dataFile) throws IOException {
      File md5File = getDigestFileForFile(dataFile);
  
      String md5Line;
      
      if (!md5File.exists()) {
        return null;
      }
      
      BufferedReader reader =
        new BufferedReader(new FileReader(md5File));
      try {
        md5Line = reader.readLine();
        if (md5Line == null) { md5Line = ""; }
        md5Line = md5Line.trim();
      } catch (IOException ioe) {
        throw new IOException("Error reading md5 file at " + md5File, ioe);
      } finally {
        IOUtils.cleanup(LOG, reader);
      }
      
      Matcher matcher = LINE_REGEX.matcher(md5Line);
      if (!matcher.matches()) {
        throw new IOException("Invalid MD5 file at " + md5File
            + " (does not match expected pattern)");
      }
      String storedHash = matcher.group(1);
      File referencedFile = new File(matcher.group(2));
  
      // Sanity check: Make sure that the file referenced in the .md5 file at
      // least has the same name as the file we expect
      if (!referencedFile.getName().equals(dataFile.getName())) {
        throw new IOException(
            "MD5 file at " + md5File + " references file named " +
            referencedFile.getName() + " but we expected it to reference " +
            dataFile);
      }
      return new MD5Hash(storedHash);
    }
docs: Read the md5 checksum stored alongside the given file, or null
  if no md5 is stored.
  @param dataFile the file containing data
  @return the checksum stored in dataFile.md5