Class FileUtils

java.lang.Object
org.apache.rat.utils.FileUtils

public final class FileUtils extends Object
A set of utilities to help process files.
  • Method Details

    • mkDir

      public static void mkDir(File dir)
      Creates a directory if it does not exist.
      Parameters:
      dir - the directory to make.
    • delete

      public static void delete(File file)
      Deletes a file if it exists (ignoring all IO-related exceptions).
      Parameters:
      file - the file to delete.
    • writeFile

      public static File writeFile(File dir, String name, Iterable<String> lines)
      Writes a test file.
      Parameters:
      dir - The directory to write the file in.
      name - the name of the file.
      lines - the lines to write into the file.
      Returns:
      the new File.
    • writeFile

      public static File writeFile(File dir, String name, String... lines)
      Writes a test file.
      Parameters:
      dir - The directory to write the file in.
      name - the name of the file.
      lines - the lines to write into the file.
      Returns:
      the new File.
    • writeFile

      public static File writeFile(File dir, String name)
      Writes a text file containing the name of the file.
      Parameters:
      dir - The directory to write the file into.
      name - the name of the file.
      Returns:
      the new file.