|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.pf.file.FileWalker
public class FileWalker
This class provides services to navigate through a file directory and handle files that match a name filter.
Field Summary | |
---|---|
static java.lang.String |
PATTERN_SEPARATOR
The character to be used to separate filename patterns (';') as String. |
static char |
PATTERN_SEPARATOR_CHAR
The character to be used to separate filename patterns (';'). |
Constructor Summary | |
---|---|
FileWalker(FileHandler handler)
Initialize the new instance with default values. |
|
FileWalker(FileHandler handler,
char digitWildcard)
Initialize the new instance with a file handler and a wildcard character for digits. |
Method Summary | |
---|---|
protected java.lang.String[] |
extractPatterns(java.lang.String pattern)
|
protected java.lang.Character |
getDigitWildcard()
|
protected char |
getDigitWildcardChar()
|
protected FileHandler |
getFileHandler()
|
protected boolean |
getGoOn()
|
protected boolean |
hasDigitWildcard()
|
protected void |
setDigitWildcard(java.lang.Character newValue)
|
void |
setDigitWildcardChar(char digitWildcard)
Sets the given character as a wildcard character to match digits ('0'-'9') only. |
protected void |
setFileHandler(FileHandler newValue)
|
protected void |
setGoOn(boolean newValue)
|
protected long |
walkThrough(java.lang.String dir,
java.io.FilenameFilter filter,
boolean recursive)
|
long |
walkThrough(java.lang.String dir,
java.lang.String pattern,
boolean recursive)
This method starts in the given directory to search for all files matching the given pattern(s). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final char PATTERN_SEPARATOR_CHAR
public static final java.lang.String PATTERN_SEPARATOR
Constructor Detail |
---|
public FileWalker(FileHandler handler)
public FileWalker(FileHandler handler, char digitWildcard)
handler
- The file handler that gets all found filesdigitWildcard
- A character that is used as wildcard for digits in filname patternsMethod Detail |
---|
protected FileHandler getFileHandler()
protected void setFileHandler(FileHandler newValue)
protected boolean getGoOn()
protected void setGoOn(boolean newValue)
protected java.lang.Character getDigitWildcard()
protected void setDigitWildcard(java.lang.Character newValue)
public long walkThrough(java.lang.String dir, java.lang.String pattern, boolean recursive)
If recursive is true it goes down to each subdirectory and doing
the same there.
For each matching file (non-directory) the defined FileHandler.handle()
is called.
dir
- The directory where to startpattern
- The file name pattern(s) for filtering out the correct files ( wildcards '*' and '?' )recursive
- If set to true, the file selection is going down to all subdirectories
public void setDigitWildcardChar(char digitWildcard)
digitWildcard
- The placeholder character for digitsprotected long walkThrough(java.lang.String dir, java.io.FilenameFilter filter, boolean recursive)
protected java.lang.String[] extractPatterns(java.lang.String pattern)
protected char getDigitWildcardChar()
protected boolean hasDigitWildcard()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |