Constructor and Description |
---|
FileUtils() |
Modifier and Type | Method and Description |
---|---|
static File |
createTempDirectory(String prefix,
String suffix,
File directory)
Creates a new temp directory in the specified directory, using the given prefix and suffix strings to generate its name.
|
static void |
deleteRecursively(Path path)
Deletes a file or directory and all contents recursively.
|
static String |
getExtension(String fileName) |
static String |
getFileNameWithExtension(URL url)
Extract a file name with it's extension from the given URL.
|
static void |
removeDir(File dir)
Remove directories and files recursively
|
static Properties |
resolvePropertiesFile(String fileNamePath) |
public static void removeDir(File dir)
dir
- the root dir to be removed, (will be also removed)public static void deleteRecursively(Path path) throws IOException
path
- the file to delete.IOException
public static File createTempDirectory(String prefix, String suffix, File directory) throws IOException
The prefix argument must be at least three characters long. It is recommended that the prefix be a short, meaningful string such as "hjb" or "mail". The suffix argument may be null, in which case the suffix ".tmpdir" will be used.
prefix
- The prefix string to be used in generating the directory's name; must be at least three characters longsuffix
- The suffix string to be used in generating the directory's name; may be null, in which case the suffix ".tmpdir" will be useddirectory
- The directory in which the temp directory is to be created, or null if the default temporary-file directory is to be usedIOException
- if the directory cannot be createdpublic static String getFileNameWithExtension(URL url)
url
- input urlpublic static Properties resolvePropertiesFile(String fileNamePath)