Package org.esa.snap.core.util.io
Class TreeCopier
- java.lang.Object
-
- org.esa.snap.core.util.io.TreeCopier
-
- All Implemented Interfaces:
FileVisitor<Path>
public class TreeCopier extends Object implements FileVisitor<Path>
AFileVisitorthat copies a file tree.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidcopy(Path source, Path target)Deeply copies the contents of the directory given bysourceinto the existing directory given bytarget.static PathcopyDir(Path source, Path targetParent)Deeply copies the directory given bysourceinto a directory with the same name located in an existing parent directory given bytargetParent.FileVisitResultpostVisitDirectory(Path dir, IOException exception)FileVisitResultpreVisitDirectory(Path dir, BasicFileAttributes attributes)FileVisitResultvisitFile(Path file, BasicFileAttributes attributes)FileVisitResultvisitFileFailed(Path file, IOException exception)
-
-
-
Method Detail
-
copyDir
public static Path copyDir(Path source, Path targetParent) throws IOException
Deeply copies the directory given bysourceinto a directory with the same name located in an existing parent directory given bytargetParent. A new directory will be created if it does not exists yet, otherwise its contents will be overwritten.- Parameters:
source- The source directory.targetParent- The target's parent directory. Must already exist.- Throws:
IOException
-
copy
public static void copy(Path source, Path target) throws IOException
Deeply copies the contents of the directory given bysourceinto the existing directory given bytarget. The method overwrites any existing content.- Parameters:
source- The source directory.target- The target directory. Must already exist.- Throws:
IOException
-
visitFile
public FileVisitResult visitFile(Path file, BasicFileAttributes attributes) throws IOException
- Specified by:
visitFilein interfaceFileVisitor<Path>- Throws:
IOException
-
preVisitDirectory
public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attributes) throws IOException
- Specified by:
preVisitDirectoryin interfaceFileVisitor<Path>- Throws:
IOException
-
postVisitDirectory
public FileVisitResult postVisitDirectory(Path dir, IOException exception) throws IOException
- Specified by:
postVisitDirectoryin interfaceFileVisitor<Path>- Throws:
IOException
-
visitFileFailed
public FileVisitResult visitFileFailed(Path file, IOException exception)
- Specified by:
visitFileFailedin interfaceFileVisitor<Path>
-
-