public class RegExFilenameFilter extends FileFilter implements FileFilter, FilenameFilter
String.matches(String)
,
Pattern
Modifier and Type | Class and Description |
---|---|
static class |
RegExFilenameFilter.Directory
A switch to decide whether the results of a
RegExFilenameFilter are forbidden, allowed or required to be a directory. |
Constructor and Description |
---|
RegExFilenameFilter(String desc,
RegExFilenameFilter.Directory dir,
boolean ignoreCase,
String... regex)
Creates a new
RegExFilenameFilter with given
regular expressions regex to be found in the
file name of the File s to be filtered. |
Modifier and Type | Method and Description |
---|---|
boolean |
accept(File arg0) |
boolean |
accept(File dir,
String name) |
String |
getDescription() |
String |
getRegEx()
Returns a representation of all used regular expressions.
|
String |
toString() |
public RegExFilenameFilter(String desc, RegExFilenameFilter.Directory dir, boolean ignoreCase, String... regex)
RegExFilenameFilter
with given
regular expressions regex
to be found in the
file name of the File
s to be filtered.desc
- the description of the filter, e.g. "text-files
(*.txt)"dir
- a switch whether the results are forbidden, allowed or required to be a directoryignoreCase
- indicates whether to ignore the case of the file names or notregex
- an array of regular expressions; at least one regular expression has to match
the file namepublic boolean accept(File arg0)
accept
in interface FileFilter
accept
in class FileFilter
public boolean accept(File dir, String name)
accept
in interface FilenameFilter
public String getDescription()
getDescription
in class FileFilter
public String getRegEx()