The character-oriented streams (Readers and Writers)
translate data between an internal 16-bit format and
an external UTF format.
This is convenient for many text processing applications.
However, this translation is not appropriate for
non-character data.
This chapter discusses OutputStream
and its subclasses
which are used for binary output.
They do not translate the data from what is on the disk to what is delivered to your program.
Most data types represent data using all the possible patterns that can be formed from their bits. A file that contains such data is often called a binary file. A byte from a binary file might hold any possible pattern. (A byte from an ASCII text file is restricted to somewhat less than half of the possible patterns).
Recall (from chapter 2!) the four advantages of binary:
Because of the fourth advantage, anything that can be represented with some sort of pattern can be represented with pattrns of bits in a disk file. You need I/O methods that read and write these patterns without change.
(Review: ) How many patterns can be formed using 8 bits?