Class FileUtils

java.lang.Object
io.deephaven.base.FileUtils

public class FileUtils extends Object
  • Constructor Details

    • FileUtils

      public FileUtils()
  • Method Details

    • cleanDirectory

      public static void cleanDirectory(File path)
      Cleans the specified path. All files and subdirectories in the path will be deleted. (ie you'll be left with an empty directory).
      Parameters:
      path - The path to clean
    • deleteRecursively

      public static void deleteRecursively(File file)
    • moveRecursively

      public static void moveRecursively(File source, File destination, @Nullable @Nullable FileFilter filter, boolean allowReplace)
      Move files accepted by a filter from their relative path under source to the same relative path under destination. Creates missing destination subdirectories as needed.
      Parameters:
      source - Must be a directory.
      destination - Must be a directory if it exists.
      filter - Applied to normal files, only. We recurse on directories automatically.
      allowReplace - If the destination regular file exists, do we replace it, or silently ignore it?
    • deleteRecursivelyOnNFS

      public static void deleteRecursivelyOnNFS(File file)
      Recursive delete method that copes with .nfs files. Uses the file's parent as the trash directory.
      Parameters:
      file -
    • deleteRecursivelyOnNFS

      public static void deleteRecursivelyOnNFS(File trashFile, File fileToBeDeleted)
      Recursive delete method that copes with .nfs files.
      Parameters:
      trashFile - Filename to move regular files to before deletion. .nfs files may be created in its parent directory.
      fileToBeDeleted - File or directory at which to begin recursive deletion.
    • findAllFiles

      public static File[] findAllFiles(File dir)
      Scan directory recursively to find all files
      Parameters:
      dir -
      Returns:
    • missingSafeListFiles

      public static File[] missingSafeListFiles(File directory)
    • missingSafeListFiles

      public static File[] missingSafeListFiles(File directory, FileFilter filter)
    • missingSafeListSubDirectories

      public static File[] missingSafeListSubDirectories(File directory)
    • missingSafeListFilenames

      public static String[] missingSafeListFilenames(File directory)
    • missingSafeListFilenames

      public static String[] missingSafeListFilenames(File directory, FilenameFilter filter)
    • missingSafeListSubDirectoryNames

      public static String[] missingSafeListSubDirectoryNames(File directory)
    • readTextFile

      public static String readTextFile(File txtFile) throws IOException
      Throws:
      IOException
    • readTextFile

      public static String readTextFile(InputStream txtFile) throws IOException
      Throws:
      IOException