|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.commons.io.filefilter.AbstractFileFilter org.apache.commons.io.filefilter.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 < files.length; i++) { System.out.println(files[i]); }
Constructor Summary | |
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 |
Method Summary | |
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. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public WildcardFilter(String wildcard)
wildcard
- wildcard to match
IllegalArgumentException
- if the pattern is nullpublic WildcardFilter(String[] wildcards)
wildcards
- wildcards to match
IllegalArgumentException
- if the pattern array is nullpublic WildcardFilter(List wildcards)
wildcards
- list of wildcards to match
IllegalArgumentException
- if the pattern list is null
ClassCastException
- if the list does not contain StringsMethod Detail |
public boolean accept(File dir, String name)
accept
in interface IOFileFilter
accept
in class AbstractFileFilter
dir
- the file directoryname
- the filename
public boolean accept(File file)
accept
in interface IOFileFilter
accept
in class AbstractFileFilter
file
- the file to check
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |