
11.3 Reading and Writing Text Files 757
Figure 11.10
The Inheritance Hierarchy for Output Classes
Writer
FileWriter
Object
BufferedWriter PrintWriterOutputStreamWriter
OutputStream
PrintStream
FileOutputStream ObjectOutputStreamFilterOutputStream
11.3 Reading and Writing Text Files
Java supports two file types, text and binary. In text files, data is stored as
characters; in binary files, data is stored as raw bytes. Different classes are
used for writing and reading each file type. The type of a file is determined
when the file is written to and depends on which classes were used to write
to the file. Thus, to read from an existing file, you must know the ...