public class FilenamePatternFilter
extends java.lang.Object
implements java.io.FilenameFilter
Constructor and Description |
---|
FilenamePatternFilter()
Construct a FilenamePatternFilter with an empty regular
expression pattern list.
|
FilenamePatternFilter(java.util.Collection<java.util.regex.Pattern> collection)
Construct a FilenamePatternFilter with a collection of
pre-compiled regular expression patterns.
|
FilenamePatternFilter(java.util.regex.Pattern pattern)
Construct a FilenamePatternFilter with a single pre-compiled
regular expression pattern.
|
FilenamePatternFilter(java.util.regex.Pattern[] patterns)
Construct a FilenamePatternFilter with an array of pre-compiled
regular expression patterns.
|
FilenamePatternFilter(java.lang.String patternStr)
Construct a FilenamePatternFilter with a regular expression
pattern string.
|
FilenamePatternFilter(java.lang.String[] patternStrs)
Construct a FilenamePatternFilter with an array of regular
expression pattern strings.
|
FilenamePatternFilter(java.lang.String[] patternStrs,
int reOpts)
Construct a FilenamePatternFilter with an array of regular
expression pattern strings and an option mask for the regular
expression compiler.
|
FilenamePatternFilter(java.lang.String[] patternStrs,
int[] reOpts)
Construct a FilenamePatternFilter with an array of regular
expression pattern strings and an array of option masks for the
regular expression compiler.
|
FilenamePatternFilter(java.lang.String patternStr,
int reOpts)
Construct a FilenamePatternFilter with a regular expression
pattern string, and an option mask for the regular expression
compiler.
|
Modifier and Type | Method and Description |
---|---|
boolean |
accept(java.io.File dir,
java.lang.String name) |
void |
add(java.util.regex.Pattern pattern)
Add a pre-compiled regular expression pattern to the internal
list.
|
void |
add(java.util.regex.Pattern[] patterns)
Add an array of pre-compiled regular expression patterns to the
internal list.
|
void |
add(java.lang.String patternStr)
Add a regular expression pattern string to the internal list.
|
void |
add(java.lang.String[] patternStrs)
Add an array of regular expression pattern strings to the
internal list.
|
void |
add(java.lang.String[] patternStrs,
int reOpts)
Add an array of regular expression pattern strings to the
internal list and compile them with an option mask.
|
void |
add(java.lang.String[] patternStrs,
int[] reOpts)
Add an array of regular expression pattern strings to the
internal list and compile them with an array of option masks, one
for each pattern string.
|
void |
add(java.lang.String patternStr,
int reOpts)
Add a regular expression pattern string to the internal list
and compile it with an option mask.
|
void |
remove(java.util.regex.Pattern pattern)
Remove a pre-compiled regular expression pattern from the
internal list.
|
void |
remove(java.util.regex.Pattern[] patterns)
Remove an array of pre-compiled regular expression patterns
from the internal list.
|
public FilenamePatternFilter()
public FilenamePatternFilter(java.util.Collection<java.util.regex.Pattern> collection)
collection
- collection of regular expression patternspublic FilenamePatternFilter(java.util.regex.Pattern pattern)
pattern
- regular expression patternpublic FilenamePatternFilter(java.util.regex.Pattern[] patterns)
patterns
- array of regular expression patternspublic FilenamePatternFilter(java.lang.String patternStr)
patternStr
- string with a regular expression patternpublic FilenamePatternFilter(java.lang.String patternStr, int reOpts)
patternStr
- string with a regular expression patternreOpts
- int with the regular expression compiler optionspublic FilenamePatternFilter(java.lang.String[] patternStrs)
patternStrs
- array of regular expression pattern stringspublic FilenamePatternFilter(java.lang.String[] patternStrs, int reOpts)
patternStrs
- array of regular expression pattern stringsreOpts
- int with the regular expression compiler optionspublic FilenamePatternFilter(java.lang.String[] patternStrs, int[] reOpts)
patternStrs
- array of regular expression pattern stringsreOpts
- array of regular expression compiler optionspublic void add(java.util.regex.Pattern pattern)
pattern
- regular expression pattern to addpublic void add(java.util.regex.Pattern[] patterns)
patterns
- array of regular expression patterns to addpublic void add(java.lang.String patternStr)
patternStr
- regular expression string to addpublic void add(java.lang.String patternStr, int reOpts)
patternStr
- regular expression string to addreOpts
- int with the regular expression compiler optionspublic void add(java.lang.String[] patternStrs)
patternStrs
- array of regular expression strings to addpublic void add(java.lang.String[] patternStrs, int reOpts)
patternStrs
- array of regular expression strings to addreOpts
- int with the regular expression compiler optionspublic void add(java.lang.String[] patternStrs, int[] reOpts)
patternStrs
- array of regular expression strings to addreOpts
- array of regular expression compiler optionspublic void remove(java.util.regex.Pattern pattern)
pattern
- regular expression pattern to removepublic void remove(java.util.regex.Pattern[] patterns)
patterns
- array of regular expression patterns to removepublic boolean accept(java.io.File dir, java.lang.String name)
accept
in interface java.io.FilenameFilter
dir
- the directory in which the file was foundname
- the name of the file to checktrue
if the filename matches one of the
regular expression patterns in the internal list;
false
otherwise