Class ExtensionFileFilter
java.lang.Object
com.sun.interview.ExtensionFileFilter
- All Implemented Interfaces:
FileFilter
A filter which accepts files based on their extension.
-
Constructor Summary
ConstructorsConstructorDescriptionExtensionFileFilter(String[] extns, String description) Create a filter which accepts files based on their extension.ExtensionFileFilter(String extn, String description) Create a filter which accepts files based on their extension. -
Method Summary
Modifier and TypeMethodDescriptionbooleanCheck if a file is accepted by this filter.booleanCheck if (all) directories are accepted by this filter.ensureExtension(File file) Ensure that a filename ends with one of the extensions accepted by this filter.ensureExtension(String path) Ensure that a pathname ends with one of the extensions accepted by this filter.Get a short description for this filter.booleanCheck whether or not this filter should perform case-sensitive matching for extensions.voidsetCaseSensitive(boolean b) Specify whether or not this filter should perform case-sensitive matching for extensions.
-
Constructor Details
-
ExtensionFileFilter
-
ExtensionFileFilter
-
-
Method Details
-
isCaseSensitive
public boolean isCaseSensitive()Check whether or not this filter should perform case-sensitive matching for extensions.- Returns:
- true if this filter should perform case-sensitive matching for extensions, and false otherwise
- See Also:
-
setCaseSensitive
public void setCaseSensitive(boolean b) Specify whether or not this filter should perform case-sensitive matching for extensions.- Parameters:
b- true if this filter should perform case-sensitive matching for extensions, and false otherwise- See Also:
-
accept
Description copied from interface:FileFilterCheck if a file is accepted by this filter.- Specified by:
acceptin interfaceFileFilter- Parameters:
f- The file to be tested.- Returns:
- true if the file is accepted by this filter
-
acceptsDirectories
public boolean acceptsDirectories()Description copied from interface:FileFilterCheck if (all) directories are accepted by this filter.- Specified by:
acceptsDirectoriesin interfaceFileFilter- Returns:
- true if directories are accepted by this filter
-
getDescription
Get a short description for this filter.- Specified by:
getDescriptionin interfaceFileFilter- Returns:
- a short description of this filter
-
ensureExtension
Ensure that a pathname ends with one of the extensions accepted by this filter. If it does not, one is appended- Parameters:
path- The path to be checked.- Returns:
- the original path if it already ended with a valid extension, or if it was null or empty; otherwise, a copy of the path is returned, with a valid extension added on.
-
ensureExtension
Ensure that a filename ends with one of the extensions accepted by this filter. If it does not, one is appended- Parameters:
file- The file to be checked.- Returns:
- the original file if it already ended with a valid extension, or if it was null or empty; otherwise, a new file is returned, whose path is a copy of the original, with a valid extension added on.
-