public class DirUtils
extends java.lang.Object
This static class provides various utility methods for manipulating directories.
Modifier and Type | Field and Description |
---|---|
protected static int |
MAX_DIR_CREATE_TRIES
Maximum number of tries to create a temporary directory.
|
Modifier | Constructor and Description |
---|---|
protected |
DirUtils()
Don't allow instantiation, do allow overrides.
|
Modifier and Type | Method and Description |
---|---|
static java.io.File |
createTemporaryDirectory(java.lang.String baseName)
Create a temporary directory.
|
static boolean |
deleteDirectory(java.io.File directory)
Delete a directory.
|
static boolean |
deleteDirectory(java.lang.String directory)
Delete a directory.
|
protected static void |
emptyOutDirectory(java.io.File directory)
Empty out a directory.
|
static java.lang.String |
getTemporaryFilesDirectory()
Get temporary files directory.
|
protected static int MAX_DIR_CREATE_TRIES
public static java.lang.String getTemporaryFilesDirectory()
public static java.io.File createTemporaryDirectory(java.lang.String baseName) throws java.lang.IllegalStateException
baseName
- Base name for generating temporory name.java.lang.IllegalStateException
- If temporary directory cannot be created.public static boolean deleteDirectory(java.io.File directory)
directory
- Directory to deletepublic static boolean deleteDirectory(java.lang.String directory)
directory
- Directory to deleteprotected static void emptyOutDirectory(java.io.File directory)
directory
- Directory to empty.