Package com.sun.interview
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 TypeMethodDescriptionboolean
Check if a file is accepted by this filter.boolean
Check 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.boolean
Check whether or not this filter should perform case-sensitive matching for extensions.void
setCaseSensitive
(boolean b) Specify whether or not this filter should perform case-sensitive matching for extensions.
-
Constructor Details
-
ExtensionFileFilter
Create a filter which accepts files based on their extension.- Parameters:
extn
- The required extension for files that are to be accepted by this filter.description
- A short string describing the filter.
-
ExtensionFileFilter
Create a filter which accepts files based on their extension.- Parameters:
extns
- Any array of permissible extensions for files that are to be accepted by this filter.description
- A short string describing the filter.
-
-
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:FileFilter
Check if a file is accepted by this filter.- Specified by:
accept
in 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:FileFilter
Check if (all) directories are accepted by this filter.- Specified by:
acceptsDirectories
in interfaceFileFilter
- Returns:
- true if directories are accepted by this filter
-
getDescription
Get a short description for this filter.- Specified by:
getDescription
in 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.
-