public class CopyFileVisitor extends SimpleFileVisitor<Path>
FileVisitor
which copies the source Path
to the target Path
. Constructor and Description |
---|
CopyFileVisitor(Path source,
Path target,
CopyOption... options)
Creates a new instance of this class.
|
Modifier and Type | Method and Description |
---|---|
static Path |
copy(Path source,
Path target,
CopyOption... options)
Copies the source to the target.
|
FileVisitResult |
preVisitDirectory(Path dir,
BasicFileAttributes attrs) |
FileVisitResult |
visitFile(Path file,
BasicFileAttributes attrs) |
postVisitDirectory, visitFileFailed
public CopyFileVisitor(Path source, Path target, CopyOption... options)
source
- the sourcetarget
- the targetoptions
- copy optionscopy(java.nio.file.Path, java.nio.file.Path, java.nio.file.CopyOption...)
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
public static Path copy(Path source, Path target, CopyOption... options) throws IOException
source
- the sourcetarget
- the targetoptions
- the copy optionsIOException
- if an I/O error is thrownCopyright © 2002–2019 SoftSmithy. All rights reserved.