|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.faunos.util.tree.AbstractTraverser<File>
com.faunos.util.io.file.FileSystemTraverser
public class FileSystemTraverser
A depth-first, directory structure traverser.
This class is not safe under concurrent access.
TraverseListener,
Euler
Traversal| Constructor Summary | |
|---|---|
FileSystemTraverser(File root)
Creates a new instance with the given root file (usually a directory). |
|
FileSystemTraverser(File root,
TraverseListener<File> listener,
FileFilter filter,
Comparator<File> siblingOrder)
Creates a new instance with the given root file (usually a directory). |
|
| Method Summary | |
|---|---|
protected File[] |
getChildren(File node)
Returns the files in the given directory node, applying this instance's filter, if any. |
FileFilter |
getFilter()
Returns the filter used to determine whether files will be visited. |
protected boolean |
hasChildren(File node)
Returns true is the specified file node is a directory. |
void |
setFilter(FileFilter filter)
Sets the filter used to determine whether files will be visited. |
static void |
visitPostorder(File root,
Visitor<File> visitor,
FileFilter filter)
Visits the root file, and if a directory, and traverses the directory structure, firing post-order events along the way. |
static void |
visitPostorder(File root,
Visitor<File> visitor,
FileFilter filter,
Comparator<File> siblingOrder)
Visits the root file, and if a directory, and traverses the directory structure, firing post-order events along the way. |
static void |
visitPreorder(File root,
Visitor<File> visitor,
FileFilter filter)
Visits the root file, and if a directory, and traverses the directory structure, firing pre-order events along the way. |
static void |
visitPreorder(File root,
Visitor<File> visitor,
FileFilter filter,
Comparator<File> siblingOrder)
Visits the root file, and if a directory, and traverses the directory structure, firing pre-order events along the way. |
| Methods inherited from class com.faunos.util.tree.AbstractTraverser |
|---|
getListener, getSiblingOrder, run, setListener, setSiblingOrder, visitPostorder, visitPreorder |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public FileSystemTraverser(File root)
public FileSystemTraverser(File root,
TraverseListener<File> listener,
FileFilter filter,
Comparator<File> siblingOrder)
| Method Detail |
|---|
public static void visitPreorder(File root,
Visitor<File> visitor,
FileFilter filter)
root - the root of the directory structure (must exist)visitor - the callback interface invoked on traversalfilter - optional file filter (may be null)
public static void visitPreorder(File root,
Visitor<File> visitor,
FileFilter filter,
Comparator<File> siblingOrder)
root - the root of the directory structure (must exist)visitor - the callback interface invoked on traversalfilter - optional file filter (may be null)siblingOrder - determines the order files in a same directory get visited. If
null, the files' natural ordering is used.
public static void visitPostorder(File root,
Visitor<File> visitor,
FileFilter filter)
root - the root of the directory structure (must exist)visitor - the callback interface invoked on traversalfilter - optional file filter (may be null)
public static void visitPostorder(File root,
Visitor<File> visitor,
FileFilter filter,
Comparator<File> siblingOrder)
root - the root of the directory structure (must exist)visitor - the callback interface invoked on traversalfilter - optional file filter (may be null)siblingOrder - determines the order files in a same directory get visited. If
null, the files' natural ordering is used.public void setFilter(FileFilter filter)
public FileFilter getFilter()
protected File[] getChildren(File node)
getChildren in class AbstractTraverser<File>protected boolean hasChildren(File node)
hasChildren in class AbstractTraverser<File>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||