/** * Compares the contents of two files. * * @param f1 the file whose content is to be compared. * @param f2 the other file whose content is to be compared. * * @return true if the content of the files is the same. * * @throws IOException if the files cannot be read. */ public boolean contentEquals(File f1, File f2) throws IOException { return contentEquals(f1, f2, false); }
/** * comparison method of the interface * * @return true if the files are equal * @exception BuildException if it all went pear-shaped */ @Override public boolean eval() throws BuildException { //validate if (file1 == null || file2 == null) { throw new BuildException( "both file1 and file2 are required in filesmatch"); } //#now match the files boolean matches = false; try { matches = FILE_UTILS.contentEquals(file1, file2, textfile); } catch (IOException ioe) { throw new BuildException("when comparing files: " + ioe.getMessage(), ioe); } return matches; } }
return !FILE_UTILS.contentEquals(srcfile, destfile); } catch (IOException e) { throw new BuildException(
destIsWrong = !FILE_UTILS.contentEquals(destFile, tmpFile); log(destFile + (destIsWrong ? " is being written" : " is not written, as the contents are identical"),