Class FileCompare
java.lang.Object
org.apache.fop.tools.anttasks.FileCompare
This class is an extension of Ant, a script utility from
http://ant.apache.org.
It provides methods to compare two files.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static booleancompareBytes(File file1, File file2) Compare the contents of two files.static booleancompareFiles(File f1, File f2) Compares two files to see if they are equalprivate static booleancompareFileSize(File oldFile, File newFile) Does a file size compare of two filesvoidexecute()Main method of task compareprivate booleanfilesExist(File oldFile, File newFile) voidsetFilenames(String filenames) Sets the comma-separated list of files to process.voidsetReferenceDirectory(String referenceDirectory) Sets directory for reference files.voidsetTestDirectory(String testDirectory) Sets directory for test files.private voidwriteHeader(PrintWriter results)
-
Field Details
-
referenceDirectory
-
testDirectory
-
filenameList
-
-
Constructor Details
-
FileCompare
public FileCompare()
-
-
Method Details
-
setTestDirectory
Sets directory for test files.- Parameters:
testDirectory- the test directory
-
setReferenceDirectory
Sets directory for reference files.- Parameters:
referenceDirectory- the reference directory
-
setFilenames
Sets the comma-separated list of files to process.- Parameters:
filenames- list of files, comma-separated
-
compareFiles
Compares two files to see if they are equal- Parameters:
f1- first file to comparef2- second file to compare- Returns:
- true if files are same, false otherwise
- Throws:
IOException- if not caught
-
compareBytes
Compare the contents of two files.- Parameters:
file1- the first file to comparefile2- the second file to compare- Returns:
- true if files are same byte-by-byte, false otherwise
- Throws:
IOException
-
compareFileSize
-
filesExist
-
writeHeader
-
execute
public void execute() throws org.apache.tools.ant.BuildExceptionMain method of task compare- Throws:
org.apache.tools.ant.BuildException- If the execution fails.
-