|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.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 | |
|---|---|
static java.lang.String |
PATTERN_SEPARATOR
The character to be used to separate filename patterns (';') as String. |
| Constructor Summary | |
|---|---|
ExtendedFileFilter()
Initialize the new instance with default values. |
|
ExtendedFileFilter(boolean restrictive)
Initialize the new instance with the option of a more restrictive handling of wildcard matching. |
|
ExtendedFileFilter(char wildcardForDigits)
Initialize the new instance with a wildcard character for digits. |
|
ExtendedFileFilter(char wildcardForDigits,
boolean restrictive)
Initialize the new instance with a wildcard character for digits in filenames and the option of a more restrictive handling of wildcard matching. |
|
ExtendedFileFilter(java.lang.String patternList)
Initialize the new instance with patterns. |
|
| Method Summary | |
|---|---|
boolean |
accept(java.io.File dir,
java.lang.String name)
Tests if a specified file should be included in a file list. |
void |
addPattern(java.lang.String pattern)
Adds a pattern. |
void |
addPattern(java.lang.String pattern,
boolean ignoreCase)
Adds a pattern. |
void |
addPattern(java.lang.String pattern,
boolean ignoreCase,
char digitWildcardChar)
Adds a pattern. |
void |
addPattern(java.lang.String pattern,
char digitWildcardChar)
Adds a pattern. |
void |
addPatterns(java.lang.String patternList)
Adds one or more patterns separated by semi-colon (';'). |
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. |
void |
checkNameOfDirectories()
Sets the filter to only accept directories that match a defined pattern. |
boolean |
matches(java.lang.Object object)
Returns if this filter matches the given object. |
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. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String PATTERN_SEPARATOR
| Constructor Detail |
|---|
public ExtendedFileFilter()
public ExtendedFileFilter(java.lang.String patternList)
patternList - A list of patterns (may be just one)addPatterns(String)public ExtendedFileFilter(char wildcardForDigits)
wildcardForDigits - The character that stands for any digit (0-9) in a filenamepublic ExtendedFileFilter(boolean restrictive)
Example:
restrictive=true => "text.doc" does NOT match the pattern "text*.doc"
restrictive=false => "text.doc" does match the pattern "text*.doc"
restrictive - To restrict the match of '*' to at least one character
public ExtendedFileFilter(char wildcardForDigits,
boolean restrictive)
See other constructor for examples.
wildcardForDigits - The character that stands for any digit (0-9) in a filenamerestrictive - To restrict the match of '*' to at least one character| Method Detail |
|---|
public void addPattern(java.lang.String pattern)
pattern - The pattern string containing optional wildcards ( '*', '?' )
public void addPattern(java.lang.String pattern,
char digitWildcardChar)
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 ( '*', '?' )digitWildcardChar - The character that will be treated as wildcard for digits ('0'-'9')
public void addPattern(java.lang.String pattern,
boolean ignoreCase)
pattern - The pattern string containing optional wildcards ( '*', '?' )ignoreCase - If true, all character comparisons are ignoring uppercase/lowercase
public void addPattern(java.lang.String pattern,
boolean ignoreCase,
char digitWildcardChar)
pattern - The pattern string containing optional wildcards ( '*', '?' )ignoreCase - If true, all character comparisons are ignoring uppercase/lowercasedigitWildcardChar - The character that will be treated as wildcard for digits ('0'-'9')public void addPatterns(java.lang.String patternList)
patternList - The list of filename patternspublic void checkNameOfDirectories()
public void alwaysIncludeDirectories()
public void alwaysExcludeDirectories()
public boolean accept(java.io.File dir,
java.lang.String name)
accept in interface java.io.FilenameFilterdir - the directory in which the file was found.name - the name of the file.
public boolean matches(java.lang.Object object)
matches in interface IObjectFilterobject - Any object
public boolean mustIncludeDirectories()
public boolean mustExcludeDirectories()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||