Name
FilenameFilter
Synopsis
This interface defines the
accept( )
method that must be implemented by
any object that filters filenames (i.e., selects a subset of
filenames from a list of filenames). There are no standard
FilenameFilter
classes implemented by Java, but
objects that implement this interface are used by the
java.awt.FileDialog
object and the
File.list( )
method. A typical
FilenameFilter
object might check that the
specified File
represents a file (not a
directory), is readable (and possibly writable as well), and that its
name ends with some desired extension.
public interface FilenameFilter { // Public Instance Methods boolean accept(File dir, String name); }
Passed To
File.{list( )
, listFiles( )}
Get Java in a Nutshell, 5th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.