Package org.apache.commons.io.file
Class CopyDirectoryVisitor
- java.lang.Object
-
- java.nio.file.SimpleFileVisitor<Path>
-
- org.apache.commons.io.file.SimplePathVisitor
-
- org.apache.commons.io.file.CountingPathVisitor
-
- org.apache.commons.io.file.CopyDirectoryVisitor
-
- All Implemented Interfaces:
FileVisitor<Path>,PathVisitor
public class CopyDirectoryVisitor extends CountingPathVisitor
Copies a source directory to a target directory.- Since:
- 2.7
-
-
Constructor Summary
Constructors Constructor Description CopyDirectoryVisitor(Counters.PathCounters pathCounter, Path sourceDirectory, Path targetDirectory, CopyOption... copyOptions)Constructs a new visitor that deletes files except for the files and directories explicitly given.CopyDirectoryVisitor(Counters.PathCounters pathCounter, PathFilter fileFilter, PathFilter dirFilter, Path sourceDirectory, Path targetDirectory, CopyOption... copyOptions)Constructs a new visitor that deletes files except for the files and directories explicitly given.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)CopyOption[]getCopyOptions()Gets the copy options.PathgetSourceDirectory()Gets the source directory.PathgetTargetDirectory()Gets the target directory.inthashCode()FileVisitResultpreVisitDirectory(Path directory, BasicFileAttributes attributes)FileVisitResultvisitFile(Path sourceFile, BasicFileAttributes attributes)-
Methods inherited from class org.apache.commons.io.file.CountingPathVisitor
getPathCounters, postVisitDirectory, toString, withBigIntegerCounters, withLongCounters
-
Methods inherited from class java.nio.file.SimpleFileVisitor
visitFileFailed
-
Methods inherited from interface java.nio.file.FileVisitor
visitFileFailed
-
-
-
-
Constructor Detail
-
CopyDirectoryVisitor
public CopyDirectoryVisitor(Counters.PathCounters pathCounter, Path sourceDirectory, Path targetDirectory, CopyOption... copyOptions)
Constructs a new visitor that deletes files except for the files and directories explicitly given.- Parameters:
pathCounter- How to count visits.sourceDirectory- The source directorytargetDirectory- The target directorycopyOptions- Specifies how the copying should be done.
-
CopyDirectoryVisitor
public CopyDirectoryVisitor(Counters.PathCounters pathCounter, PathFilter fileFilter, PathFilter dirFilter, Path sourceDirectory, Path targetDirectory, CopyOption... copyOptions)
Constructs a new visitor that deletes files except for the files and directories explicitly given.- Parameters:
pathCounter- How to count visits.fileFilter- How to filter file paths.dirFilter- How to filter directory paths.sourceDirectory- The source directorytargetDirectory- The target directorycopyOptions- Specifies how the copying should be done.- Since:
- 2.9.0
-
-
Method Detail
-
equals
public boolean equals(Object obj)
- Overrides:
equalsin classCountingPathVisitor
-
getCopyOptions
public CopyOption[] getCopyOptions()
Gets the copy options.- Returns:
- the copy options.
- Since:
- 2.8.0
-
getSourceDirectory
public Path getSourceDirectory()
Gets the source directory.- Returns:
- the source directory.
- Since:
- 2.8.0
-
getTargetDirectory
public Path getTargetDirectory()
Gets the target directory.- Returns:
- the target directory.
- Since:
- 2.8.0
-
hashCode
public int hashCode()
- Overrides:
hashCodein classCountingPathVisitor
-
preVisitDirectory
public FileVisitResult preVisitDirectory(Path directory, BasicFileAttributes attributes) throws IOException
- Specified by:
preVisitDirectoryin interfaceFileVisitor<Path>- Overrides:
preVisitDirectoryin classCountingPathVisitor- Throws:
IOException
-
visitFile
public FileVisitResult visitFile(Path sourceFile, BasicFileAttributes attributes) throws IOException
- Specified by:
visitFilein interfaceFileVisitor<Path>- Overrides:
visitFilein classCountingPathVisitor- Throws:
IOException
-
-