public class RegexpFileFilter
extends java.lang.Object
implements java.io.FileFilter
FileFilter
interface
that filter files and directories based on regular expressions.Modifier and Type | Field and Description |
---|---|
private java.util.regex.Pattern |
directoryPattern |
private java.util.regex.Pattern |
filePattern |
Constructor and Description |
---|
RegexpFileFilter(java.util.regex.Pattern filePattern,
java.util.regex.Pattern directoryPattern)
Create a new file filter from patterns.
|
RegexpFileFilter(java.lang.String fileRegexp,
java.lang.String directoryRegexp)
Create a new file filter from a string regular expressions.
|
Modifier and Type | Method and Description |
---|---|
boolean |
accept(java.io.File file)
Accept files with a name matching the regular expression
|
private final java.util.regex.Pattern filePattern
private final java.util.regex.Pattern directoryPattern
public RegexpFileFilter(java.lang.String fileRegexp, java.lang.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(java.util.regex.Pattern filePattern, java.util.regex.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 directories