|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.io.DirectoryWalker<Future<File>>
it.geosolutions.tools.io.file.CopyTree
public class CopyTree
Copy a Tree recursively and asynchronously
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.apache.commons.io.DirectoryWalker |
---|
org.apache.commons.io.DirectoryWalker.CancelException |
Constructor Summary | |
---|---|
CopyTree(FileFilter filter,
CompletionService<File> cs,
File sourceDir,
File destDir)
CopyTree(FileFilter, CompletionService, int, File, File) |
|
CopyTree(FileFilter filter,
CompletionService<File> cs,
int depth,
File sourceDir,
File destDir)
|
Method Summary | |
---|---|
boolean |
addCollectingListener(Progress<String> listener)
|
boolean |
addCopyListener(Progress<String> listener)
|
static Future<File> |
asyncCopyTree(CompletionService<File> cs,
File source,
File sourceDir,
File destinationDir,
Progress<String> listener)
|
int |
copy()
Copy the entire tree recursively (depending from the passed filter) can be interrupted using setCancelled(true) |
protected File[] |
filterDirectoryContents(File directory,
int depth,
File[] files)
#DirectoryWalker#filterDirectoryContents(File, int, File[]) |
protected void |
handleCancelled(File startDirectory,
Collection<Future<File>> results,
org.apache.commons.io.DirectoryWalker.CancelException cancel)
#DirectoryWalker#handleCancelled(File, Collection,
org.apache.commons.io.DirectoryWalker.CancelException) |
protected boolean |
handleDirectory(File directory,
int depth,
Collection<Future<File>> results)
#DirectoryWalker#handleDirectory(File, int, Collection) |
protected void |
handleEnd(Collection<Future<File>> results)
collecting operation is concluded DirectoryWalker.handleEnd(Collection) |
protected void |
handleFile(File file,
int depth,
Collection<Future<File>> results)
This method is called by the DirectoryWalker.walk() one. |
protected boolean |
handleIsCancelled(File file,
int depth,
Collection<Future<File>> results)
#DirectoryWalker#handleIsCancelled(File, int, Collection) |
protected void |
handleStart(File startDirectory,
Collection<Future<File>> results)
collecting operation is started DirectoryWalker.handleEnd(Collection) |
boolean |
isCancelled()
|
void |
reset(boolean force)
Deprecated. untested method |
void |
setCancelled()
set the canceled status for all pending operations |
Methods inherited from class org.apache.commons.io.DirectoryWalker |
---|
checkIfCancelled, handleDirectoryEnd, handleDirectoryStart, handleRestricted, walk |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CopyTree(FileFilter filter, CompletionService<File> cs, File sourceDir, File destDir)
CopyTree(FileFilter, CompletionService, int, File, File)
public CopyTree(FileFilter filter, CompletionService<File> cs, int depth, File sourceDir, File destDir)
filter
- the filter to apply, null means visit all filescs
- the CompletionService to usedepth
- controls how deep the hierarchy is navigated to (less than 0
means unlimited)sourceDir
- destDir
- Method Detail |
---|
public final boolean isCancelled()
public final void setCancelled()
public boolean addCollectingListener(Progress<String> listener)
listener
- the listener to add
Collection.add(Object)
public boolean addCopyListener(Progress<String> listener)
listener
- the listener to add
Collection.add(Object)
public void reset(boolean force)
force
- if in progress works should be canceledpublic int copy() throws IOException, IllegalStateException
IOException
- DirectoryWalker.walk(File, Collection)
IllegalStateException
- if CopyTree object is not in a legal state: call
#reset()
public static Future<File> asyncCopyTree(CompletionService<File> cs, File source, File sourceDir, File destinationDir, Progress<String> listener) throws RejectedExecutionException, IllegalArgumentException
cs
- CompletionServicesource
- file to copysourceDir
- where source is mounteddestinationDir
- mount point where to copy source
RejectedExecutionException
- - if this task cannot be accepted for execution.
IllegalArgumentException
- - if executor is null or terminated.protected boolean handleIsCancelled(File file, int depth, Collection<Future<File>> results) throws IOException
#DirectoryWalker#handleIsCancelled(File, int, Collection)
handleIsCancelled
in class org.apache.commons.io.DirectoryWalker<Future<File>>
IOException
protected void handleCancelled(File startDirectory, Collection<Future<File>> results, org.apache.commons.io.DirectoryWalker.CancelException cancel) throws IOException
#DirectoryWalker#handleCancelled(File, Collection,
org.apache.commons.io.DirectoryWalker.CancelException)
handleCancelled
in class org.apache.commons.io.DirectoryWalker<Future<File>>
IOException
protected boolean handleDirectory(File directory, int depth, Collection<Future<File>> results) throws IOException
#DirectoryWalker#handleDirectory(File, int, Collection)
handleDirectory
in class org.apache.commons.io.DirectoryWalker<Future<File>>
IOException
protected File[] filterDirectoryContents(File directory, int depth, File[] files) throws IOException
#DirectoryWalker#filterDirectoryContents(File, int, File[])
filterDirectoryContents
in class org.apache.commons.io.DirectoryWalker<Future<File>>
IOException
protected void handleFile(File file, int depth, Collection<Future<File>> results) throws IOException, SecurityException
#DirectoryWalker#handleFile(File, int, Collection)
handleFile
in class org.apache.commons.io.DirectoryWalker<Future<File>>
IOException
SecurityException
protected void handleStart(File startDirectory, Collection<Future<File>> results) throws IOException
DirectoryWalker.handleEnd(Collection)
handleStart
in class org.apache.commons.io.DirectoryWalker<Future<File>>
IOException
protected void handleEnd(Collection<Future<File>> results) throws IOException
DirectoryWalker.handleEnd(Collection)
handleEnd
in class org.apache.commons.io.DirectoryWalker<Future<File>>
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |