9.3. Summary
In this chapter, I've discussed the facilities for inspecting physical files and directories and for writing basic types of data to a file. The important points I have discussed include the following:
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.
Get Ivor Horton's Beginning Java™ 2, JDK™ 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.