Methods Summary |
---|
public boolean | accept(java.io.File dir, java.lang.String name)Tests if a specified file should be included in a file list.
File fileOrDir = null ;
fileOrDir = new File( dir, name ) ;
if ( fileOrDir.isDirectory() )
{
if ( this.mustIncludeDirectories() )
return true ;
if ( this.mustExcludeDirectories() )
return false ;
}
return ( this.checkAgainstPatterns( name ) ) ;
|
public void | addPattern(java.lang.String pattern)Adds a pattern. All filenames match this pattern are acceptable.
Case sensitivity is switched on !
StringPattern stringPattern = null ;
stringPattern = new StringPattern( pattern, false ) ;
this.getStringPatterns().add( stringPattern ) ;
|
public void | addPattern(java.lang.String pattern, char digitWildcard)Adds a pattern. All filenames match this pattern are acceptable.
Case sensitivity is switched on !
The second parameter specifies a character that will be recognized in the
pattern as a placeholder for a single digit character.
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".
StringPattern stringPattern = null ;
stringPattern = new StringPattern( pattern, false, digitWildcard ) ;
this.getStringPatterns().add( stringPattern ) ;
|
public void | addPattern(java.lang.String pattern, boolean ignoreCase)Adds a pattern. All filenames match this pattern are acceptable.
StringPattern stringPattern = null ;
stringPattern = new StringPattern( pattern, ignoreCase ) ;
this.getStringPatterns().add( stringPattern ) ;
|
public void | addPattern(java.lang.String pattern, boolean ignoreCase, char digitWildcard)Adds a pattern. All filenames that match this pattern are acceptable.
Additionally to the standard wildcards '*' and '?' a wildcard for single
digit characters ('0' - '9') can be specified here.
StringPattern stringPattern = null ;
stringPattern = new StringPattern( pattern, ignoreCase, digitWildcard ) ;
this.getStringPatterns().add( stringPattern ) ;
|
public void | alwaysExcludeDirectories()Sets the filter to never accept directories.
this.setDirHandling( DIR_EXCLUDE ) ;
|
public void | alwaysIncludeDirectories()Sets the filter to always accept directories, even if they don't match
a given pattern.
this.setDirHandling( DIR_INCLUDE ) ;
|
protected boolean | checkAgainstPatterns(java.lang.String name)
Iterator iterator = null ;
StringPattern pattern = null ;
iterator = this.getStringPatterns().iterator() ;
while ( iterator.hasNext() )
{
pattern = (StringPattern)iterator.next() ;
if ( pattern.matches( name ) )
return true ;
} // while
return false ; // No pattern matched
|
public void | checkNameOfDirectories()Sets the filter to only accept directories that match a defined pattern.
this.setDirHandling( DIR_CHECK_NAME ) ;
|
protected int | getDirHandling()
return dirHandling ;
|
protected java.util.List | getStringPatterns()
return stringPatterns ;
|
public boolean | mustExcludeDirectories()Returns true if the filter never accepts directories.
return ( this.getDirHandling() == DIR_EXCLUDE ) ;
|
public boolean | mustIncludeDirectories()Returns true if the filter always accepts directories, even if they don't match
a given pattern.
return ( this.getDirHandling() == DIR_INCLUDE ) ;
|
protected void | setDirHandling(int newValue) dirHandling = newValue ;
|
protected void | setStringPatterns(java.util.List newValue) stringPatterns = newValue ;
|