Package ffx.utilities

Class FileUtils

java.lang.Object
ffx.utilities.FileUtils

public class FileUtils extends Object
FileUtils class.
Since:
1.0
Author:
Michael J. Schnieders
  • Method Details

    • copyInputStreamToTmpFile

      public static String copyInputStreamToTmpFile(InputStream input, String prefix, String name, String suffix) throws IOException
      Returns the file name of a temporary copy of input content.
      Parameters:
      input - The input stream contents are copied to a temporary file.
      prefix - Temporary file prefix.
      name - Temporary file name.
      suffix - Temporary file suffix.
      Returns:
      The temporary file.
      Throws:
      IOException - An IOException is thrown if a temporary file could not be created.
    • relativePathTo

      public static Path relativePathTo(File file)
      Constructs a relative path from the present working directory to a file.
      Parameters:
      file - Construct a relative path to file.
      Returns:
      Relative path to file.
    • traverseFiles

      public static List<File> traverseFiles(File directory, int maxDepth, String filePattern)
      Traverse a directory to find files matching the given regex pattern.
      Parameters:
      directory - The directory to traverse.
      maxDepth - Maximum depth to traverse.
      filePattern - Regular expression pattern to match file names.
      Returns:
      List of matching files.
    • append

      public static void append(File file, String content)
      Append content to a file.
      Parameters:
      file - The file to append content to.
      content - The content to append.