|
![]() |
![]() |
![]() |
![]() |
In this chapter, we have discussed the facilities for inspecting physical files and directories, and for writing basic types of data to a file. The important points we have discussed include:
An object of the class File can encapsulate a file or directory path. The path encapsulated by a File object does not necessarily correspond to a physical file or directory.
You can use a File object to test whether the path it encapsulates refers to a physical file or directory. If it does not, there are methods available to create it together with any directories that are part of the path that may also be required.
The File class defines static methods for creating temporary files.
An object of type FileDescriptor can also identify a physical file.
A FileOutputStream object can be created from a File object and the file will be opened for writing. If the file does not exist it will be created where possible.
You can lead a horse to water but you can't make him drink.
![]() |
![]() |
![]() |