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 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.