Java Reference
In-Depth Information
Theoverloaded
list()
methodsreturnarraysof
String
sdenotingfileanddirect-
orynames.Thesecondmethodletsyoureturnonlythosenamesofinterest(suchasonly
namesendingwithextension
.txt
)viaa
java.io.FilenameFilter
-basedfilter
object.
The
FilenameFilter
interface declares a single
boolean accept(File
dir, String name)
methodthat'scalledforeachfile/directorylocatedinthedir-
ectory identified by the
File
object's abstract pathname:
•
dir
identifies the parent portion of the pathname (the directory path).