Package org.apache.commons.io.file
Class CopyDirectoryVisitor
- java.lang.Object
-
- java.nio.file.SimpleFileVisitor<java.nio.file.Path>
-
- org.apache.commons.io.file.SimplePathVisitor
-
- org.apache.commons.io.file.CountingPathVisitor
-
- org.apache.commons.io.file.CopyDirectoryVisitor
-
- All Implemented Interfaces:
java.nio.file.FileVisitor<java.nio.file.Path>
public class CopyDirectoryVisitor extends CountingPathVisitor
Copies a source directory to a target directory.- Since:
- 2.7
-
-
Field Summary
Fields Modifier and Type Field Description private java.nio.file.CopyOption[]
copyOptions
private static java.nio.file.CopyOption[]
EMPTY_COPY_OPTIONS
private java.nio.file.Path
sourceDirectory
private java.nio.file.Path
targetDirectory
-
Fields inherited from class org.apache.commons.io.file.CountingPathVisitor
EMPTY_STRING_ARRAY
-
-
Constructor Summary
Constructors Constructor Description CopyDirectoryVisitor(Counters.PathCounters pathCounter, java.nio.file.Path sourceDirectory, java.nio.file.Path targetDirectory, java.nio.file.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 java.nio.file.FileVisitResult
preVisitDirectory(java.nio.file.Path directory, java.nio.file.attribute.BasicFileAttributes attributes)
java.nio.file.FileVisitResult
visitFile(java.nio.file.Path sourceFile, java.nio.file.attribute.BasicFileAttributes attributes)
-
Methods inherited from class org.apache.commons.io.file.CountingPathVisitor
equals, getPathCounters, hashCode, postVisitDirectory, toString, updateFileCounters, withBigIntegerCounters, withLongCounters
-
-
-
-
Constructor Detail
-
CopyDirectoryVisitor
public CopyDirectoryVisitor(Counters.PathCounters pathCounter, java.nio.file.Path sourceDirectory, java.nio.file.Path targetDirectory, java.nio.file.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.
-
-
Method Detail
-
preVisitDirectory
public java.nio.file.FileVisitResult preVisitDirectory(java.nio.file.Path directory, java.nio.file.attribute.BasicFileAttributes attributes) throws java.io.IOException
- Specified by:
preVisitDirectory
in interfacejava.nio.file.FileVisitor<java.nio.file.Path>
- Overrides:
preVisitDirectory
in classjava.nio.file.SimpleFileVisitor<java.nio.file.Path>
- Throws:
java.io.IOException
-
visitFile
public java.nio.file.FileVisitResult visitFile(java.nio.file.Path sourceFile, java.nio.file.attribute.BasicFileAttributes attributes) throws java.io.IOException
- Specified by:
visitFile
in interfacejava.nio.file.FileVisitor<java.nio.file.Path>
- Overrides:
visitFile
in classCountingPathVisitor
- Throws:
java.io.IOException
-
-