public class MoreFiles extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
deleteDirectoryContents(Path path)
Deletes the contents of the given directory.
|
static void |
deleteRecursively(Path path)
Deletes the given file or directory.
|
static Path |
ensureDirectory(Path path)
Ensures the existence of the given directory.
|
static Path |
ensureParentDirectory(Path path)
Ensures the existence of the parent directory of the given file or directory.
|
static boolean |
isEmptyDirectory(Path path)
Checks whether the given path is an empty directory.
|
public static void deleteDirectoryContents(Path path) throws IOException
IllegalArgumentException - if path is nullIllegalArgumentException - if path is not an existing directoryIOException - if an I/O occurspublic static void deleteRecursively(Path path) throws IOException
IllegalArgumentException - if path is nullIOException - if an I/O error occurspublic static Path ensureDirectory(Path path) throws IOException
FileAlreadyExistsException - if path already exists but is not a directoryIllegalArgumentException - if path is nullIOException - if an I/O error occurspublic static Path ensureParentDirectory(Path path) throws IOException
FileAlreadyExistsException - if the parent directory of path already exists but is not a directoryIllegalArgumentException - if path is nullIOException - if an I/O error occurspublic static boolean isEmptyDirectory(Path path) throws IOException
IllegalArgumentException - if path is nullIOException - if an I/O occurs