|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.pf.file.ExtendedFileFilter
public class ExtendedFileFilter
This filter implements the standard pattern matching on UNIX and Windows
platforms. It supports the wildcards '*' and '?' on file names.
It allows to set more than one pattern.
Apart from that it allows control over inclusion/exclusion of directories
independently from name patterns.
Field Summary | |
---|---|
protected static int |
DIR_CHECK_NAME
|
protected static int |
DIR_EXCLUDE
|
protected static int |
DIR_INCLUDE
|
Constructor Summary | |
---|---|
ExtendedFileFilter()
Initialize the new instance with default values. |
Method Summary | |
---|---|
boolean |
accept(File dir,
String name)
Tests if a specified file should be included in a file list. |
void |
addPattern(String pattern)
Adds a pattern. |
void |
addPattern(String pattern,
boolean ignoreCase)
Adds a pattern. |
void |
addPattern(String pattern,
boolean ignoreCase,
char digitWildcard)
Adds a pattern. |
void |
addPattern(String pattern,
char digitWildcard)
Adds a pattern. |
void |
alwaysExcludeDirectories()
Sets the filter to never accept directories. |
void |
alwaysIncludeDirectories()
Sets the filter to always accept directories, even if they don't match a given pattern. |
protected boolean |
checkAgainstPatterns(String name)
|
void |
checkNameOfDirectories()
Sets the filter to only accept directories that match a defined pattern. |
protected int |
getDirHandling()
|
protected List |
getStringPatterns()
|
boolean |
mustExcludeDirectories()
Returns true if the filter never accepts directories. |
boolean |
mustIncludeDirectories()
Returns true if the filter always accepts directories, even if they don't match a given pattern. |
protected void |
setDirHandling(int newValue)
|
protected void |
setStringPatterns(List newValue)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final int DIR_CHECK_NAME
protected static final int DIR_INCLUDE
protected static final int DIR_EXCLUDE
Constructor Detail |
---|
public ExtendedFileFilter()
Method Detail |
---|
protected List getStringPatterns()
protected void setStringPatterns(List newValue)
protected int getDirHandling()
protected void setDirHandling(int newValue)
public void addPattern(String pattern)
pattern
- The pattern string containing optional wildcards ( '*', '?' )public void addPattern(String pattern, char digitWildcard)
A patterb "XX-####.log" with a digitWildcard set to '#' wil match to "XX-2000.log" and "XX-7376.log" but not to "XX-C363.log" and "XX-dddd.log".
pattern
- The pattern string containing optional wildcards ( '*', '?' )digitWildcard
- The character that will be treated as wildcard for digits ('0'-'9')public void addPattern(String pattern, boolean ignoreCase)
pattern
- The pattern string containing optional wildcards ( '*', '?' )ignoreCase
- If true, all character comparisons are ignoring uppercase/lowercasepublic void addPattern(String pattern, boolean ignoreCase, char digitWildcard)
pattern
- The pattern string containing optional wildcards ( '*', '?' )ignoreCase
- If true, all character comparisons are ignoring uppercase/lowercasedigitWildcard
- The character that will be treated as wildcard for digits ('0'-'9')public void checkNameOfDirectories()
public void alwaysIncludeDirectories()
public void alwaysExcludeDirectories()
public boolean accept(File dir, String name)
accept
in interface FilenameFilter
dir
- the directory in which the file was found.name
- the name of the file.
protected boolean checkAgainstPatterns(String name)
public boolean mustIncludeDirectories()
public boolean mustExcludeDirectories()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |