public class CopyVisitor extends SimpleFileVisitor<Path>
Constructor and Description |
---|
CopyVisitor(Path source,
Path target,
CopyOption... copyOptions)
构造
|
Modifier and Type | Method and Description |
---|---|
FileVisitResult |
preVisitDirectory(Path dir,
BasicFileAttributes attrs) |
FileVisitResult |
visitFile(Path file,
BasicFileAttributes attrs) |
postVisitDirectory, visitFileFailed
public CopyVisitor(Path source, Path target, CopyOption... copyOptions)
source
- 源Path,或基准路径,用于计算被拷贝文件的相对路径target
- 目标PathcopyOptions
- 拷贝选项,如跳过已存在等public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException
preVisitDirectory
in interface FileVisitor<Path>
preVisitDirectory
in class SimpleFileVisitor<Path>
IOException
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException
visitFile
in interface FileVisitor<Path>
visitFile
in class SimpleFileVisitor<Path>
IOException
Copyright © 2024. All rights reserved.