|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.sadun.util.ExtensionFilenameFilter
A simple FilenameFilter based on file extensions.
Constructor Summary | |
ExtensionFilenameFilter(java.lang.String extensions)
Create a filter which will accept the given extension (denoted by a comma-separated string) |
|
ExtensionFilenameFilter(java.lang.String[] ext)
Create a filter which will filter the given extension (denoted by a string array) |
|
ExtensionFilenameFilter(java.lang.String[] ext,
boolean doAccept)
Create a filter which will filter the given extension (denoted by a string array) |
|
ExtensionFilenameFilter(java.lang.String extensions,
boolean doAccept)
Create a filter which will accept or refuse the given extension (denoted by a comma-separated string) |
Method Summary | |
boolean |
accept(java.io.File dir,
java.lang.String name)
Accept or refuse a file basing on its extension and the current working mode (see getAcceptsExtensions() ). |
boolean |
getAcceptsExtensions()
Return true if the filter is currently set to accept files whose extension matches the extensions provided at construction. |
void |
invert()
Invert the filter - after this call, files that were accepted will be refused, and vice versa (see getAcceptsExtensions() ). |
java.lang.String |
lastMatchingExtension()
Returns the extension that has been last matched in a call of accept() , or null if accept has never been invoked or
no extension has been matched. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ExtensionFilenameFilter(java.lang.String extensions)
extensions
- a comma-separated string with the extensionspublic ExtensionFilenameFilter(java.lang.String extensions, boolean doAccept)
extensions
- a comma-separated string with the extensionsdoAccept
- if true, the filter will accept the files
with the given extensions, refuse otherwise.public ExtensionFilenameFilter(java.lang.String[] ext)
public ExtensionFilenameFilter(java.lang.String[] ext, boolean doAccept)
doAccept
- if true, the filter will accept the files
with the given extensions, refuse otherwise.Method Detail |
public boolean accept(java.io.File dir, java.lang.String name)
getAcceptsExtensions()
).
accept
in interface java.io.FilenameFilter
public void invert()
getAcceptsExtensions()
).
public boolean getAcceptsExtensions()
public java.lang.String lastMatchingExtension()
accept()
, or null if accept has never been invoked or
no extension has been matched.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |