|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.bbn.openmap.util.wanderer.Wanderer
public class Wanderer
A Wanderer is a class that traverses a directory tree and finds files and directories. It then makes a method call on the WandererCallback class to have something done on those directories or files. Subclasses can set whether the search is exhaustive (ignoring returns from handleDirectory that the search was successful) and/or runs top to bottom of the directory structure, or bottom to top.
Field Summary | |
---|---|
protected boolean |
exhaustiveSearch
|
protected boolean |
topToBottom
|
Constructor Summary | |
---|---|
Wanderer()
|
|
Wanderer(WandererCallback callback)
|
Method Summary | |
---|---|
WandererCallback |
getCallback()
|
protected boolean |
handleDirectory(java.io.File directory,
java.lang.String[] contentNames)
Management method for the wanderer, that steps through the children of the directory and calls handleEntry for them. |
boolean |
handleEntry(java.io.File file)
Given a file representing a top-level directory, start wandering the tree and call handleDirectory or handleFile on the WandererCallback. |
boolean |
isExhaustiveSearch()
|
boolean |
isTopToBottom()
|
static void |
main(java.lang.String[] argv)
Given a set of files or directories, parade through them to change their case. |
void |
setCallback(WandererCallback cb)
|
void |
setExhaustiveSearch(boolean exhaustiveSearch)
|
void |
setTopToBottom(boolean topToBottom)
Set to true if handleDirectory is called before moving to handleFile/handleDirectory for child files. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected boolean exhaustiveSearch
protected boolean topToBottom
Constructor Detail |
---|
public Wanderer()
public Wanderer(WandererCallback callback)
Method Detail |
---|
public void setCallback(WandererCallback cb)
public WandererCallback getCallback()
public boolean handleEntry(java.io.File file)
file
- File (directory) to start at.
protected boolean handleDirectory(java.io.File directory, java.lang.String[] contentNames) throws java.lang.SecurityException
directory
- the directory to handlecontentNames
- an array of Strings representing children of the directory
java.lang.SecurityException
public boolean isExhaustiveSearch()
public void setExhaustiveSearch(boolean exhaustiveSearch)
exhaustiveSearch
- set to true if you want to ignore the
handleDirectory and handleFile return values.public boolean isTopToBottom()
public void setTopToBottom(boolean topToBottom)
topToBottom
- public static void main(java.lang.String[] argv)
argv
- paths to files or directories, use -h to get a usage
statement.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |