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
Copies a source directory to a target directory.
- Since:
- 2.7
- 
Nested Class SummaryNested classes/interfaces inherited from class org.apache.commons.io.file.CountingPathVisitorCountingPathVisitor.AbstractBuilder<T,B extends CountingPathVisitor.AbstractBuilder<T, B>>, CountingPathVisitor.Builder 
- 
Constructor SummaryConstructorsConstructorDescriptionCopyDirectoryVisitor(Counters.PathCounters pathCounter, Path sourceDirectory, Path targetDirectory, CopyOption... copyOptions) Constructs an instance that copies all files.CopyDirectoryVisitor(Counters.PathCounters pathCounter, PathFilter fileFilter, PathFilter dirFilter, Path sourceDirectory, Path targetDirectory, CopyOption... copyOptions) Constructs an instance that copies files matching the given file and directory filters.
- 
Method SummaryModifier and TypeMethodDescriptionprotected voidCopies the sourceFile to the targetFile.booleanGets the copy options.Gets the source directory.Gets the target directory.inthashCode()preVisitDirectory(Path directory, BasicFileAttributes attributes) visitFile(Path sourceFile, BasicFileAttributes attributes) Methods inherited from class org.apache.commons.io.file.CountingPathVisitoraccept, getPathCounters, postVisitDirectory, toString, updateDirCounter, updateFileCounters, withBigIntegerCounters, withLongCountersMethods inherited from class org.apache.commons.io.file.SimplePathVisitorvisitFileFailed
- 
Constructor Details- 
CopyDirectoryVisitorpublic CopyDirectoryVisitor(Counters.PathCounters pathCounter, Path sourceDirectory, Path targetDirectory, CopyOption... copyOptions) Constructs an instance that copies all files.- Parameters:
- pathCounter- How to count visits.
- sourceDirectory- The source directory
- targetDirectory- The target directory
- copyOptions- Specifies how the copying should be done.
 
- 
CopyDirectoryVisitorpublic CopyDirectoryVisitor(Counters.PathCounters pathCounter, PathFilter fileFilter, PathFilter dirFilter, Path sourceDirectory, Path targetDirectory, CopyOption... copyOptions) Constructs an instance that copies files matching the given file and directory filters.- Parameters:
- pathCounter- How to count visits.
- fileFilter- How to filter file paths.
- dirFilter- How to filter directory paths.
- sourceDirectory- The source directory
- targetDirectory- The target directory
- copyOptions- Specifies how the copying should be done.
- Since:
- 2.9.0
 
 
- 
- 
Method Details- 
copyCopies the sourceFile to the targetFile.- Parameters:
- sourceFile- the source file.
- targetFile- the target file.
- Throws:
- IOException- if an I/O error occurs.
- Since:
- 2.8.0
 
- 
equals- Overrides:
- equalsin class- CountingPathVisitor
 
- 
getCopyOptionsGets the copy options.- Returns:
- the copy options.
- Since:
- 2.8.0
 
- 
getSourceDirectoryGets the source directory.- Returns:
- the source directory.
- Since:
- 2.8.0
 
- 
getTargetDirectoryGets the target directory.- Returns:
- the target directory.
- Since:
- 2.8.0
 
- 
hashCode- Overrides:
- hashCodein class- CountingPathVisitor
 
- 
preVisitDirectorypublic FileVisitResult preVisitDirectory(Path directory, BasicFileAttributes attributes) throws IOException - Specified by:
- preVisitDirectoryin interface- FileVisitor<Path>
- Overrides:
- preVisitDirectoryin class- CountingPathVisitor
- Throws:
- IOException
 
- 
visitFilepublic FileVisitResult visitFile(Path sourceFile, BasicFileAttributes attributes) throws IOException - Specified by:
- visitFilein interface- FileVisitor<Path>
- Overrides:
- visitFilein class- CountingPathVisitor
- Throws:
- IOException
 
 
-