org.apache.commons.io.filefilter
Class WildcardFilter
- FileFilter, FilenameFilter, IOFileFilter
public class WildcardFilter
Filters files using supplied wildcard(s).
See org.apache.commons.io.find.FilenameUtils.wildcardMatch() for wildcard matching rules
e.g.
File dir = new File(".");
FileFilter fileFilter = new WildcardFilter("*test*.java~*~");
File[] files = dir.listFiles(fileFilter);
for (int i = 0; i <32files.length; i++) {
System.out.println(files[i]);
}
$Revision: 155419 $ $Date: 2005-02-26 08:02:41 -0500 (Sat, 26 Feb 2005) $private String[] | wildcards - The wildcards that will be used to match filenames
|
WildcardFilter(List wildcards) - Construct a new wildcard filter for a list of wildcards
|
WildcardFilter(String wildcard) - Construct a new wildcard filter for a single wildcard
|
WildcardFilter(String[] wildcards) - Construct a new wildcard filter for an array of wildcards
|
boolean | accept(File file) - Checks to see if the filename matches one of the wildcards.
|
boolean | accept(File dir, String name) - Checks to see if the filename matches one of the wildcards.
|
wildcards
private String[] wildcards
The wildcards that will be used to match filenames
WildcardFilter
public WildcardFilter(List wildcards)
Construct a new wildcard filter for a list of wildcards
wildcards
- list of wildcards to match
WildcardFilter
public WildcardFilter(String wildcard)
Construct a new wildcard filter for a single wildcard
wildcard
- wildcard to match
WildcardFilter
public WildcardFilter(String[] wildcards)
Construct a new wildcard filter for an array of wildcards
wildcards
- wildcards to match
accept
public boolean accept(File file)
Checks to see if the filename matches one of the wildcards.
- accept in interface IOFileFilter
- accept in interface AbstractFileFilter
- true if the filename matches one of the wildcards
accept
public boolean accept(File dir,
String name)
Checks to see if the filename matches one of the wildcards.
- accept in interface IOFileFilter
- accept in interface AbstractFileFilter
dir
- the file directoryname
- the filename
- true if the filename matches one of the wildcards