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
ConstructorsConstructorDescriptionCopyFileVisitor(Path target, CopyOption... options) Constructs a newCopyFileVisitorwhich 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 newCopyFileVisitorwhich 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:
preVisitDirectoryin interfaceFileVisitor<Path>- Overrides:
preVisitDirectoryin classSimpleFileVisitor<Path>- Throws:
IOException
-
visitFile
- Specified by:
visitFilein interfaceFileVisitor<Path>- Overrides:
visitFilein classSimpleFileVisitor<Path>- Throws:
IOException
-