Package ffx.utilities
Class FileUtils
java.lang.Object
ffx.utilities.FileUtils
FileUtils class.
- Since:
- 1.0
- Author:
- Michael J. Schnieders
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidAppend content to a file.static StringcopyInputStreamToTmpFile(InputStream input, String prefix, String name, String suffix) Returns the file name of a temporary copy ofinputcontent.static PathrelativePathTo(File file) Constructs a relative path from the present working directory to a file.traverseFiles(File directory, int maxDepth, String filePattern) Traverse a directory to find files matching the given regex pattern.
-
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 ofinputcontent.- 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
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
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
Append content to a file.- Parameters:
file- The file to append content to.content- The content to append.
-