Package org.spongepowered.api.util.file
Class CopyFileVisitor
- All Implemented Interfaces:
FileVisitor<Path>
Represents a
FileVisitor
which will create a copy of a directory
and its contents.
Example usage:
Files.walkFileTree(dir, new CopyFileVisitor(target);
-
Constructor Summary
ConstructorDescriptionCopyFileVisitor
(Path target, CopyOption... options) Constructs a newCopyFileVisitor
which will copy the visited file paths to the specified target directory. -
Method Summary
Modifier and TypeMethodDescriptionpreVisitDirectory
(Path dir, BasicFileAttributes attrs) visitFile
(Path file, BasicFileAttributes attrs) Methods inherited from class java.nio.file.SimpleFileVisitor
postVisitDirectory, visitFileFailed
-
Constructor Details
-
CopyFileVisitor
Constructs a newCopyFileVisitor
which will copy the visited file paths to the specified target directory.Note: The target directory must not exist since the visitor will also copy the root directory to the specified location.
- Parameters:
target
- The path to copy the visited files tooptions
- Optional options for the copy operations
-
-
Method Details
-
preVisitDirectory
- Specified by:
preVisitDirectory
in interfaceFileVisitor<Path>
- Overrides:
preVisitDirectory
in classSimpleFileVisitor<Path>
- Throws:
IOException
-
visitFile
- Specified by:
visitFile
in interfaceFileVisitor<Path>
- Overrides:
visitFile
in classSimpleFileVisitor<Path>
- Throws:
IOException
-