|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.aliasi.io.FileExtensionFilter
public class FileExtensionFilter
A file filter that accepts all base files with a suffix with a
specified value or one of a set of specified values. The
extensions are specified in the constructor, and the filter may be
set to accept or reject directories. A file is tested by name
against String.endsWith(String).
FilenameFilterfileNameFilter(). This class would simply implement both
interfaces if it weren't for the ambiguity that causes between
File#listFiles(FilenameFilter) and File.listFiles(FileFilter).
| Constructor Summary | |
|---|---|
FileExtensionFilter(boolean acceptDirectories,
String... extensions)
Create a file filter that accepts files with the specified extensions, optionally accepting directories. |
|
FileExtensionFilter(String... extensions)
Create a file filter that accepts files with the specified extensions and accepts all directories. |
|
FileExtensionFilter(String extension)
Create a file filter that accepts files with the specified extension and accepts all directories. |
|
FileExtensionFilter(String[] extensions,
boolean acceptDirectories)
Deprecated. Use the variable-length argument version FileExtensionFilter(boolean,String[]) instead. |
|
FileExtensionFilter(String extension,
boolean acceptDirectories)
Create a file filter that accepts files with the specified extension, optionally accepting directories. |
|
| Method Summary | |
|---|---|
boolean |
accept(File pathName)
Return true if the specified file has an
an acceptable suffix as specified in the constructor. |
protected boolean |
accept(String fileName)
Returns true if the specified file name has
an acceptable suffix as specified in the constructor. |
FilenameFilter |
fileNameFilter()
Return the file name filter corresponding to this extension filter. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
@Deprecated
public FileExtensionFilter(String[] extensions,
boolean acceptDirectories)
FileExtensionFilter(boolean,String[]) instead.
extensions - Suffixes of files to accept.acceptDirectories - true if all directories
should be accepted by this filter.
public FileExtensionFilter(boolean acceptDirectories,
String... extensions)
extensions - Suffixes of files to accept.acceptDirectories - true if all directories
should be accepted by this filter.
public FileExtensionFilter(String extension,
boolean acceptDirectories)
extension - Suffix of files to accept.acceptDirectories - true if all directories
should be accepted by this filter.public FileExtensionFilter(String extension)
extension - Suffix of files to accept.public FileExtensionFilter(String... extensions)
extensions - Suffixes of files to accept.| Method Detail |
|---|
protected final boolean accept(String fileName)
true if the specified file name has
an acceptable suffix as specified in the constructor.
fileName - Name of file to test for acceptance.
true If file name is acceptable.public boolean accept(File pathName)
true if the specified file has an
an acceptable suffix as specified in the constructor.
accept in interface FileFilterpathName - File to test for acceptance.
true If file's name is acceptable.public FilenameFilter fileNameFilter()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||