org.pietschy.command.file
Class ExtensionFileFilter
FileFilter
org.pietschy.command.file.ExtensionFileFilter
public class ExtensionFileFilter
extends FileFilter
An implementation of FileFilter
that is based on the extension of a file.
ExtensionFileFilter(String extension, String description) - Creates a new filter for the specified file extension with that has the specified description.
|
ExtensionFileFilter
public ExtensionFileFilter(String extension,
String description)
Creates a new filter for the specified file extension with that has the specified description.
extension
- the file extension to excluding the preceeding '.', ie "java", not ".java".description
- the user friendly description of the file filter.
accept
public boolean accept(File f)
Accepts files that end with the specified extension.
- true if the file name ends with this filters extension.
checkAndAddExtension
public File checkAndAddExtension(File file)
Checks that the specified file has an extension defined. If it does, it is
returned as is, even if the extension doesn't match that of the filter. If no extension is
specified, a new file is returned based on the original but with the
extension defined by this filter.
file
- the file to check.
- a file guarenteed to have the extension specified by this filter.
getDescription
public String getDescription()
isIgnoreCase
public boolean isIgnoreCase()
setIgnoreCase
public void setIgnoreCase(boolean ignoreCase)