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