Package org.spongepowered.api.util.file
Class CopyFileVisitor
- java.lang.Object
-
- java.nio.file.SimpleFileVisitor<Path>
-
- org.spongepowered.api.util.file.CopyFileVisitor
-
- All Implemented Interfaces:
FileVisitor<Path>
public final class CopyFileVisitor extends SimpleFileVisitor<Path>
Represents aFileVisitorwhich will create a copy of a directory and its contents.Example usage:
Files.walkFileTree(dir, new CopyFileVisitor(target);
-
-
Constructor Summary
Constructors Constructor Description CopyFileVisitor(Path target, CopyOption... options)Constructs a newCopyFileVisitorwhich will copy the visited file paths to the specified target directory.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FileVisitResultpreVisitDirectory(Path dir, BasicFileAttributes attrs)FileVisitResultvisitFile(Path file, BasicFileAttributes attrs)-
Methods inherited from class java.nio.file.SimpleFileVisitor
postVisitDirectory, visitFileFailed
-
-
-
-
Constructor Detail
-
CopyFileVisitor
public CopyFileVisitor(Path target, CopyOption... options)
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 Detail
-
preVisitDirectory
public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException
- Specified by:
preVisitDirectoryin interfaceFileVisitor<Path>- Overrides:
preVisitDirectoryin classSimpleFileVisitor<Path>- Throws:
IOException
-
visitFile
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException
- Specified by:
visitFilein interfaceFileVisitor<Path>- Overrides:
visitFilein classSimpleFileVisitor<Path>- Throws:
IOException
-
-