org.apache.oro.io
Class RegexFilenameFilter
java.lang.Object
org.apache.oro.io.RegexFilenameFilter
- FileFilter, FilenameFilter
public abstract class RegexFilenameFilter
extends java.lang.Object
implements FilenameFilter, FileFilter
RegexFilenameFilter is the base class for a set of FilenameFilter
implementations that filter based on a regular expression.
boolean | accept(File pathname) - Filters a filename.
|
boolean | accept(File dir, String filename) - Filters a filename.
|
void | setFilterExpression(String regex) - Set the regular expression on which to filter.
|
void | setFilterExpression(String regex, int options) - Set the regular expression on which to filter along with any
special options to use when compiling the expression.
|
accept
public boolean accept(File pathname)
Filters a filename. Tests if the filename EXACTLY matches the pattern
contained by the filter. The filename is defined as pathname.getName().
Conforms to the java.io.FileFilter interface.
pathname
- The file pathname.
- True if the filename EXACTLY matches the pattern, false if not.
accept
public boolean accept(File dir,
String filename)
Filters a filename. Tests if the filename EXACTLY matches the pattern
contained by the filter. The directory argument is not examined.
Conforms to the java.io.FilenameFilter interface.
dir
- The directory containing the file.filename
- The name of the file.
- True if the filename EXACTLY matches the pattern, false if not.
setFilterExpression
public void setFilterExpression(String regex)
throws MalformedCachePatternException
Set the regular expression on which to filter.
regex
- The regular expression on which to filter.
MalformedCachePatternException
- If there is an error in
compiling the regular expression. This need not be caught if
you are using a hard-coded expression that you know is correct.
But for robustness and reliability you should catch this exception
for dynamically entered expressions determined at runtime.
setFilterExpression
public void setFilterExpression(String regex,
int options)
throws MalformedCachePatternException
Set the regular expression on which to filter along with any
special options to use when compiling the expression.
regex
- The regular expression on which to filter.options
- A set of compilation options specific to the regular
expression grammar being used.
MalformedCachePatternException
- If there is an error in
compiling the regular expression. This need not be caught if
you are using a hard-coded expression that you know is correct.
But for robustness and reliability you should catch this exception
for dynamically entered expressions determined at runtime.
Copyright B) 2000-2003 Apache Software Foundation. All Rights Reserved.