14. Files and Streams

Objectives

In this chapter you’ll learn:

• To create, read, write and update files.

• To use class File to retrieve information about files and directories.

• The Java input/output stream class hierarchy.

• The differences between text files and binary files.

• Sequential-access file processing.

• To use classes Scanner and Formatter to process text files.

• To use the FileInputStream and FileOutputStream classes.

• To use a JFileChooser dialog.

• To use the ObjectInputStream and ObjectOutputStream classes.

I can only assume that a “Do Not File” document is filed in a “Do Not File” file.

Senator Frank Church Senate Intelligence Subcommittee Hearing, 1975

Consciousness ... does not appear to itself chopped up in bits.... ...

Get Java™ for Programmers: Deitel now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.