|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.groboutils.util.io.v1.ExtensionFilenameFilter
Allows files with the given extention(s) to be accepted. You can also specify whether directories are allowed or not. This filter is case insensitive or sensitive, depending on the settings. By default, the class is case-insensitive.
The extension strings passed in are the end-of-name Strings, meaning that each file must match at least one given string at the end. So, if you want to match all "DOC" files, pass in ".doc" to match.
By default, directories are allowed, independent of their names. If directories are not allowed, then the directory names must match the extension list.
Constructor Summary | |
ExtensionFilenameFilter()
Default Constructor. |
|
ExtensionFilenameFilter(boolean caseInsensitive)
|
|
ExtensionFilenameFilter(java.lang.String extension)
Specify a single "end string" to match. |
|
ExtensionFilenameFilter(java.lang.String[] exts)
Slow, but it works. |
|
ExtensionFilenameFilter(java.lang.String[] exts,
boolean caseInsensitive)
|
|
ExtensionFilenameFilter(java.lang.String extension,
boolean caseInsensitive)
|
Method Summary | |
boolean |
accept(java.io.File dir,
java.lang.String name)
Accepts some files. |
void |
addExtension(java.lang.String ext)
Adds the given extension to the internal list. |
boolean |
allowsDirectories()
|
void |
allowsDirectories(boolean on)
|
boolean |
isCaseInsensitive()
|
protected boolean |
matches(java.lang.String filename,
java.io.File file)
Tests if the given file matches the list of extensions. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ExtensionFilenameFilter()
public ExtensionFilenameFilter(java.lang.String extension)
public ExtensionFilenameFilter(java.lang.String[] exts)
Slow, but it works.
public ExtensionFilenameFilter(boolean caseInsensitive)
public ExtensionFilenameFilter(java.lang.String extension, boolean caseInsensitive)
public ExtensionFilenameFilter(java.lang.String[] exts, boolean caseInsensitive)
Method Detail |
public void addExtension(java.lang.String ext)
public boolean allowsDirectories()
public void allowsDirectories(boolean on)
on
- true if filter allows directories to pass.public boolean isCaseInsensitive()
public boolean accept(java.io.File dir, java.lang.String name)
accept
in interface java.io.FilenameFilter
protected boolean matches(java.lang.String filename, java.io.File file)
filename
- the name of the file.file
- the File object version of the file.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |