public class DelVisitor extends SimpleFileVisitor<Path>
Modifier and Type | Field and Description |
---|---|
static DelVisitor |
INSTANCE |
Constructor and Description |
---|
DelVisitor() |
Modifier and Type | Method and Description |
---|---|
FileVisitResult |
postVisitDirectory(Path dir,
IOException e)
访问目录结束后删除目录,当执行此方法时,子文件或目录都已访问(删除)完毕
理论上当执行到此方法时,目录下已经被清空了 |
FileVisitResult |
visitFile(Path file,
BasicFileAttributes attrs) |
preVisitDirectory, visitFileFailed
public static DelVisitor 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 e) throws IOException
postVisitDirectory
in interface FileVisitor<Path>
postVisitDirectory
in class SimpleFileVisitor<Path>
dir
- 目录e
- 异常FileVisitResult
IOException
- IO异常Copyright © 2024. All rights reserved.