public class RegexpFileFilter extends Object implements FileFilter
FileFilter
interface
that filter files and directories based on regular expressions.Modifier and Type | Field and Description |
---|---|
private Pattern |
directoryPattern |
private Pattern |
filePattern |
Constructor and Description |
---|
RegexpFileFilter(Pattern filePattern,
Pattern directoryPattern)
Create a new file filter from patterns.
|
RegexpFileFilter(String fileRegexp,
String directoryRegexp)
Create a new file filter from a string regular expressions.
|
private final Pattern filePattern
private final Pattern directoryPattern
public RegexpFileFilter(String fileRegexp, String directoryRegexp)
fileRegexp
- The regular expression used to match file names or null to
match all filesdirectoryRegexp
- The regular expression used to match directory names
or null to match all directoriespublic RegexpFileFilter(Pattern filePattern, Pattern directoryPattern)
filePattern
- The pattern used to match file names, or null
to match all filesdirectoryPattern
- The pattern used to match the directory names, or null
to match all directoriespublic boolean accept(File file)
accept
in interface FileFilter