Chapter 3. Input/Output
A
computer program isn't much good unless it can
communicate with the outside world, and input/output (I/O)
capabilities are a fundamental feature of any programming platform.
In Java, I/O is done with the classes and interfaces of the
java.io package and, in Java 1.4, with the
"New IO" package
java.nio and its subpackages. This chapter
demonstrates the input/output capabilities of
java.io. The New I/O API is covered in Chapter 6. The examples here demonstrate how to:
Read and write files List directories and obtain file size and date information Use various Java stream classes Define customized stream subclasses
The techniques introduced in this chapter are also used in other
places in this book. We'll see many examples that
use streams for input and output in Chapter 5, and
we'll see a specialized kind of I/O in Chapter 10.
|