it.geosolutions.tools.io.file
Class Collector
java.lang.Object
org.apache.commons.io.DirectoryWalker<File>
it.geosolutions.tools.io.file.Collector
public class Collector
- extends org.apache.commons.io.DirectoryWalker<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 |
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(FileFilter filter)
Collector
public Collector(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(FileFilter filter)
- Set a new filter for this collector. (can be null)
- Parameters:
filter
-
collect
public List<File> collect(File root)
- Parameters:
root
-
- Returns:
- list of file (can be empty)
- Throws:
IOException
handleDirectory
protected boolean handleDirectory(File directory,
int depth,
Collection<File> results)
throws IOException
- Overrides:
handleDirectory
in class org.apache.commons.io.DirectoryWalker<File>
- Throws:
IOException
filterDirectoryContents
protected File[] filterDirectoryContents(File directory,
int depth,
File[] files)
throws IOException
- Overrides:
filterDirectoryContents
in class org.apache.commons.io.DirectoryWalker<File>
- Throws:
IOException
handleFile
protected void handleFile(File file,
int depth,
Collection<File> results)
throws IOException
- Overrides:
handleFile
in class org.apache.commons.io.DirectoryWalker<File>
- Throws:
IOException
Copyright © 2011-2012 GeoSolutions. All Rights Reserved.