Java Reference
In-Depth Information
Table 10-5
Commonly Used Output Methods Defined by
DataOutputStream
Here is the constructor for
DataOutputStream
. Notice that it is built upon an instance
of
OutputStream
.
DataOutputStream(OutputStream
outputStream
)
Here,
outputStream
is the stream to which data is written. To write output to a file, you can
use the object created by
FileOutputStream
for this parameter.
DataInputStream
implements the
DataInput
interface, which provides methods for
reading all of Java's primitive types. These methods are shown in
Table 10-6
,
and each
can throw an
IOException
.
DataInputStream
uses an
InputStream
instance as its found-
ation, overlaying it with methods that read the various Java data types. Remember that
DataInputStream
reads data in its binary format, not its human-readable form. The con-
structor for
DataInputStream
is shown here: