Can a value from an
be written to a binary file without translating it into characters?
int uses patterns of 32 bits to represent integers.
The exact pattern contained in an
int can be written to four bytes
of a binary file.
OutputStream is an abstract class from which all byte-oriented output streams descend. Its descendant classes are used for general-purpose (non-character output). These streams write groups of bytes to output destinations. Java writes the same format for primitive types on all platforms. The data in a binary file can be read by Java programs running on any platform.
A FileOuputStream connects an output stream of bytes
to a file. A DataOuputStream can be connected
FileOutputStream to provide
methods that are convenient for writing various data types.