java.io.FilenameFilter
None
None
None
JDK 1.0 or later
The FilenameFilter interface is implemented by a class that wants to filter the filenames that should be included in a list of filenames. For example, the list() method of the File class can take a FilenameFilter object to filter the filenames that are listed. The java.awt.FileDialog class also uses a FilenameFilter to limit the choices that are presented to the user.
public abstract interface java.io.FilenameFilter { // Methods public abstract boolean accept(File dir, String name); }
The directory that contains the file.
The name of the file.
true if the file should be shown; false otherwise.
This method returns a boolean value that indicates whether or not a file should be included in a list of filenames. The method should return true if a file should be included; otherwise it should return false. A simple filter might return true for filenames with a certain extension, like .java. A more complex filter could check the directory name, the file's readability, and last modification time, for example.
File