org.apache.fop.tools.anttasks

## Class FileCompare

- java.lang.Object
- - org.apache.fop.tools.anttasks.FileCompare

-     public class FileCompare
      extends Object

  This class is an extension of Ant, a script utility from http://ant.apache.org. It provides methods to compare two files.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `FileCompare()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static boolean` | `compareFiles(File f1, File f2)` Compares two files to see if they are equal
    `void` | `execute()` Main method of task compare
    `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.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### FileCompare

          public FileCompare()

  - ### Method Detail

    - #### setTestDirectory

          public void setTestDirectory(String testDirectory)

      Sets directory for test files.
      Parameters:
        `testDirectory` - the test directory

    - #### setReferenceDirectory

          public void setReferenceDirectory(String referenceDirectory)

      Sets directory for reference files.
      Parameters:
        `referenceDirectory` - the reference directory

    - #### setFilenames

          public void setFilenames(String filenames)

      Sets the comma-separated list of files to process.
      Parameters:
        `filenames` - list of files, comma-separated

    - #### compareFiles

          public static boolean compareFiles(File f1,
                                             File f2)
                                      throws IOException

      Compares two files to see if they are equal
      Parameters:
        `f1` - first file to compare
        `f2` - second file to compare
      Returns:
        true if files are same, false otherwise
      Throws:
        `IOException` - if not caught

    - #### execute

          public void execute()
                       throws org.apache.tools.ant.BuildException

      Main method of task compare
      Throws:
        `org.apache.tools.ant.BuildException` - If the execution fails.

Copyright © 2025 Apache Software Foundation. All rights reserved.