it.geosolutions.tools.io.file
Class Collector
java.lang.Object
org.apache.commons.io.DirectoryWalker<java.io.File>
it.geosolutions.tools.io.file.Collector
public class Collector
- extends org.apache.commons.io.DirectoryWalker<java.io.File>
A collector which wraps the DirectoryWalker to define a Collector which is able to collect
(recursively) a set of file starting from a base dir applying a FileFilter
- Author:
- Carlo Cancellieri - carlo.cancellieri@geo-solutions.it
| Nested classes/interfaces inherited from class org.apache.commons.io.DirectoryWalker |
org.apache.commons.io.DirectoryWalker.CancelException |
|
Constructor Summary |
Collector(java.io.FileFilter filter)
|
Collector(java.io.FileFilter filter,
int deep)
|
|
Method Summary |
java.util.List<java.io.File> |
collect(java.io.File root)
|
protected java.io.File[] |
filterDirectoryContents(java.io.File directory,
int depth,
java.io.File[] files)
|
protected boolean |
handleDirectory(java.io.File directory,
int depth,
java.util.Collection<java.io.File> results)
|
protected void |
handleFile(java.io.File file,
int depth,
java.util.Collection<java.io.File> results)
|
void |
setFilter(java.io.FileFilter filter)
Set a new filter for this collector. |
| Methods inherited from class org.apache.commons.io.DirectoryWalker |
checkIfCancelled, handleCancelled, handleDirectoryEnd, handleDirectoryStart, handleEnd, handleIsCancelled, handleRestricted, handleStart, walk |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Collector
public Collector(java.io.FileFilter filter)
Collector
public Collector(java.io.FileFilter filter,
int deep)
- Parameters:
filter - the filter to apply, null means visit all filesdeep - controls how deep the hierarchy is navigated to (less than 0 means unlimited)
setFilter
public void setFilter(java.io.FileFilter filter)
- Set a new filter for this collector. (can be null)
- Parameters:
filter -
collect
public java.util.List<java.io.File> collect(java.io.File root)
- Parameters:
root -
- Returns:
- list of file (can be empty)
- Throws:
java.io.IOException
handleDirectory
protected boolean handleDirectory(java.io.File directory,
int depth,
java.util.Collection<java.io.File> results)
throws java.io.IOException
- Overrides:
handleDirectory in class org.apache.commons.io.DirectoryWalker<java.io.File>
- Throws:
java.io.IOException
filterDirectoryContents
protected java.io.File[] filterDirectoryContents(java.io.File directory,
int depth,
java.io.File[] files)
throws java.io.IOException
- Overrides:
filterDirectoryContents in class org.apache.commons.io.DirectoryWalker<java.io.File>
- Throws:
java.io.IOException
handleFile
protected void handleFile(java.io.File file,
int depth,
java.util.Collection<java.io.File> results)
throws java.io.IOException
- Overrides:
handleFile in class org.apache.commons.io.DirectoryWalker<java.io.File>
- Throws:
java.io.IOException
Copyright © 2011-2012 GeoSolutions. All Rights Reserved.