O'Reilly logo

Ivor Horton's Beginning Java™ 2, JDK™ 5th Edition by Ivor Horton

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required