Chapter 17. Files, Streams and Object Serialization

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. ... A “river” or a “stream” are the metaphors by which it is most naturally described.

William James

Objectives

In this chapter you’ll learn:

• To create, read, write and update files.

• To retrieve information about files and directories.

• The Java input/output stream class hierarchy.

• The differences between text files and binary files.

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

• To use classes FileInputStream and FileOutputStream to read from and write ...

Get Java™ for Programmers: Deitel Developer Series, Second Edition now with O’Reilly online learning.

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