Package org.apache.fop.tools.anttasks
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 boolean
compareBytes
(File file1, File file2) Compare the contents of two files.static boolean
compareFiles
(File f1, File f2) Compares two files to see if they are equalprivate static boolean
compareFileSize
(File oldFile, File newFile) Does a file size compare of two filesvoid
execute()
Main method of task compareprivate boolean
filesExist
(File oldFile, File newFile) void
setFilenames
(String filenames) Sets the comma-separated list of files to process.void
setReferenceDirectory
(String referenceDirectory) Sets directory for reference files.void
setTestDirectory
(String testDirectory) Sets directory for test files.private void
writeHeader
(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
Does a file size compare of two files- Parameters:
oldFile
- the first file to comparenewFile
- the second file to compare- Returns:
- true if files are same length, false otherwise
-
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.
-