public class DeleteFileVisitor extends SimpleFileVisitor<Path>
FileVisitor
which will recursively delete a directory
with all its contents.
Example usage:
Files.walkFileTree(dir, DeleteFileVisitor.INSTANCE);
Modifier and Type | Field and Description |
---|---|
static DeleteFileVisitor |
INSTANCE |
Modifier | Constructor and Description |
---|---|
protected |
DeleteFileVisitor() |
Modifier and Type | Method and Description |
---|---|
FileVisitResult |
postVisitDirectory(Path dir,
IOException exc) |
FileVisitResult |
visitFile(Path file,
BasicFileAttributes attrs) |
preVisitDirectory, visitFileFailed
public static final DeleteFileVisitor INSTANCE
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException
visitFile
in interface FileVisitor<Path>
visitFile
in class SimpleFileVisitor<Path>
IOException
public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException
postVisitDirectory
in interface FileVisitor<Path>
postVisitDirectory
in class SimpleFileVisitor<Path>
IOException