This
class is a subclass of FilterOutputStream that
allows you to write Java primitive data types in a
portable binary format. Create a DataOutputStream
by specifying the OutputStream that is to be
filtered in the call to the constructor.
DataOutputStream has methods that output only
primitive types; use ObjectOutputStream to output
object values.Many of this class''s methods write a single Java
primitive type, in binary format, to the output stream.
write( ) writes a
single byte, an array, or a subarray of bytes. flush(
) forces any buffered data to be output. size(
) returns the number of bytes written so far.
writeUTF( )
outputs a Java string of
Unicode characters using a slightly modified version of the UTF-8
transformation format. UTF-8 is an ASCII-compatible encoding of
Unicode characters that is often used for the transmission and
storage of Unicode text. Except for the writeUTF(
) method, this class is used for binary output of data.
Textual output should be done with PrintWriter (or
PrintStream in Java 1.0).
Figure 9-11. java.io.DataOutputStream

public class DataOutputStream extends FilterOutputStream implements DataOutput {
// Public Constructors
public DataOutputStream (OutputStream out );
// Public Instance Methods
public final int size ( );
// Methods Implementing DataOutput
public void write (int b ) throws IOException; synchronized
public void write (byte[ ] b , int off , int len ) throws IOException; synchronized
public final void writeBoolean (boolean v ) throws IOException;
public final void writeByte (int v ) throws IOException;
public final void writeBytes (String s ) throws IOException;
public final void writeChar (int v ) throws IOException;
public final void writeChars (String s ) throws IOException;
public final void writeDouble (double v ) throws IOException;
public final void writeFloat (float v ) throws IOException;
public final void writeInt (int v ) throws IOException;
public final void writeLong (long v ) throws IOException;
public final void writeShort (int v ) throws IOException;
public final void writeUTF (String str ) throws IOException;
// Public Methods Overriding FilterOutputStream
public void flush ( ) throws IOException;
// Protected Instance Fields
protected int written ;
}