public class DefaultFilenameFilter
extends java.lang.Object
implements java.io.FilenameFilter
Modifier and Type | Field and Description |
---|---|
static java.io.FilenameFilter |
ALL
A filename filter that matches all names.
|
static java.io.FilenameFilter |
NONE
A filename filter that never matches any name.
|
Constructor and Description |
---|
DefaultFilenameFilter(java.lang.String pattern)
Initialize the new instance with the given filename pattern.
|
DefaultFilenameFilter(java.lang.String pattern,
boolean ignoreCase)
Initialize the new instance with the given filename pattern.
|
Modifier and Type | Method and Description |
---|---|
boolean |
accept(java.io.File dir,
java.lang.String name)
Tests if a given file name matches the filter.
|
protected StringPattern |
getPattern() |
protected void |
setPattern(StringPattern newValue) |
public static final java.io.FilenameFilter ALL
public static final java.io.FilenameFilter NONE
public DefaultFilenameFilter(java.lang.String pattern)
pattern
- The pattern for filenames that match. Can include wildcards '*' and '?'public DefaultFilenameFilter(java.lang.String pattern, boolean ignoreCase)
pattern
- The pattern for filenames that match. Can include wildcards '*' and '?'.
If the pattern is null, no name will match.ignoreCase
- false, if match should be done case sensitive, otherwise true.public boolean accept(java.io.File dir, java.lang.String name)
accept
in interface java.io.FilenameFilter
dir
- the directory in which the file was found.name
- the name of the file.protected StringPattern getPattern()
protected void setPattern(StringPattern newValue)