The File Class
The File class defines methods and variables that provide access to the underlying file system in a machine-independent way.
For example, there are methods getParent() and getPath(), as well as boolean methods isDirectory() and isFile(), plus many more.
A very handy method is the list() method, which returns a string array of directory contents:
- File dir = new File( "/tmp" );
- if ( dir.exists() && dir.isDirectory() )
- String directory[] = dir.list();
Instances of class File may be used in lieu of filename strings in InputStream constructors.