Java Reference
In-Depth Information
The
File
class provides several directory-related functions.
Method
Description
list()
Returns the files and directories in the directory as a String array
listFiles()
Returns the files and directories in the directory as a File array
mkdir()
Create the directory
mkdirs()
Create the tree of directories
delete()
Delete the directory
The
File
class provides access to several file-related functions.
Method
Description
createNewFile()
Returns true if the file creation is successful
createTempFile()
Creates a file in the temporary directory and returns a File if successful
delete()
Delete the file
deleteOnExit()
Delete the file when the VM shuts down
I
NPUT
S
TREAM AND
O
UTPUT
S
TREAM
InputStream
and
OutputStream
are the parent classes for all of the streams that are
used to read and write byte streams. Both classes are abstract classes. If you re-
member what abstract classes are from earlier chapters, you will recall that an ab-
stract class cannot be instantiated. That means you will never be using
InputStream
or
OutputStream
directly and will always be using classes that inherit from them.