<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<!--NewPage-->
<html>
<head>
<!-- Generated by javadoc on Wed Jul 28 01:21:15 GMT 1999 -->
<title>
  Class java.io.DataOutputStream
</title>
</head>
<body>
<a name="_top_"></a>
<pre>
<a href="packages.html">All Packages</a>  <a href="tree.html">Class Hierarchy</a>  <a href="Package-java.io.html">This Package</a>  <a href="java.io.DataInputStream.html#_top_">Previous</a>  <a href="java.io.File.html#_top_">Next</a>  <a href="AllNames.html">Index</a></pre>
<hr>
<h1>
  Class java.io.DataOutputStream
</h1>
<pre>
<a href="java.lang.Object.html#_top_">java.lang.Object</a>
   |
   +----<a href="java.io.OutputStream.html#_top_">java.io.OutputStream</a>
           |
           +----<a href="java.io.FilterOutputStream.html#_top_">java.io.FilterOutputStream</a>
                   |
                   +----java.io.DataOutputStream
</pre>
<hr>
<dl>
  <dt> public class <b>DataOutputStream</b>
  <dt> extends <a href="java.io.FilterOutputStream.html#_top_">FilterOutputStream</a>
  <dt> implements <a href="java.io.DataOutput.html#_top_">DataOutput</a>
</dl>
A data input stream lets an application write primitive Java data 
 types to an output stream in a portable way. An application can 
 then use a data input stream to read the data back in.
<p>
<dl>
    <dt> <b>See Also:</b>
    <dd> <a href="java.io.DataInputStream.html#_top_">DataInputStream</a>
</dl>
<hr>
<a name="index"></a>
<h2>
  <img src="images/variable-index.gif" width=207 height=38 alt="Variable Index">
</h2>
<dl>
  <dt> <img src="images/magenta-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#written"><b>written</b></a>
  <dd>  The number of bytes written to the data output stream.
</dl>
<h2>
  <img src="images/constructor-index.gif" width=275 height=38 alt="Constructor Index">
</h2>
<dl>
  <dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#DataOutputStream(java.io.OutputStream)"><b>DataOutputStream</b></a>(OutputStream)
  <dd>  Creates a new data output stream to write data to the specified 
 underlying output stream.
</dl>
<h2>
  <img src="images/method-index.gif" width=207 height=38 alt="Method Index">
</h2>
<dl>
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#flush()"><b>flush</b></a>()
  <dd>  Flushes this data output stream.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#size()"><b>size</b></a>()
  <dd>  Returns the number of bytes written to this data output stream.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#write(byte[], int, int)"><b>write</b></a>(byte[], int, int)
  <dd>  Writes <code>len</code> bytes from the specified byte array 
 starting at offset <code>off</code> to the underlying output stream.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#write(int)"><b>write</b></a>(int)
  <dd>  Writes the specified byte to the underlying output stream.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#writeBoolean(boolean)"><b>writeBoolean</b></a>(boolean)
  <dd>  Writes a <code>boolean</code> to the underlying output stream as 
 a 1-byte value.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#writeByte(int)"><b>writeByte</b></a>(int)
  <dd>  Writes out a <code>byte</code> to the underlying output stream as 
 a 1-byte value.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#writeBytes(java.lang.String)"><b>writeBytes</b></a>(String)
  <dd>  Writes out the string to the underlying output stream as a 
 sequence of bytes.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#writeChar(int)"><b>writeChar</b></a>(int)
  <dd>  Writes a <code>char</code> to the underlying output stream as a 
 2-byte value, high byte first.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#writeChars(java.lang.String)"><b>writeChars</b></a>(String)
  <dd>  Writes a string to the underlying output stream as a sequence of 
 characters.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#writeDouble(double)"><b>writeDouble</b></a>(double)
  <dd>  Converts the double argument to a <code>long</code> using the 
 <code>doubleToLongBits</code> method in class <code>Double</code>, 
 and then writes that <code>long</code> value to the underlying 
 output stream as an 8-byte quantity, high byte first.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#writeFloat(float)"><b>writeFloat</b></a>(float)
  <dd>  Converts the float argument to an <code>int</code> using the 
 <code>floatToIntBits</code> method in class <code>Float</code>, 
 and then writes that <code>int</code> value to the underlying 
 output stream as a 4-byte quantity, high byte first.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#writeInt(int)"><b>writeInt</b></a>(int)
  <dd>  Writes an <code>int</code> to the underlying output stream as four
 bytes, high byte first.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#writeLong(long)"><b>writeLong</b></a>(long)
  <dd>  Writes a <code>long</code> to the underlying output stream as eight
 bytes, high byte first.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#writeShort(int)"><b>writeShort</b></a>(int)
  <dd>  Writes a <code>short</code> to the underlying output stream as two
 bytes, high byte first.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#writeUTF(java.lang.String)"><b>writeUTF</b></a>(String)
  <dd>  Writes a string to the underlying output stream using UTF-8 
 encoding in a machine-independent manner.
</dl>
<a name="variables"></a>
<h2>
  <img src="images/variables.gif" width=153 height=38 alt="Variables">
</h2>
<a name="written"><img src="images/magenta-ball.gif" width=12 height=12 alt=" o "></a>
<b>written</b>
<pre>
 protected int written
</pre>
<dl>
  <dd> The number of bytes written to the data output stream.<p>
</dl>
<a name="constructors"></a>
<h2>
  <img src="images/constructors.gif" width=231 height=38 alt="Constructors">
</h2>
<a name="DataOutputStream"></a>
<a name="DataOutputStream(java.io.OutputStream)"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
<b>DataOutputStream</b>
<pre>
 public DataOutputStream(<a href="java.io.OutputStream.html#_top_">OutputStream</a> out)
</pre>
<dl>
  <dd> Creates a new data output stream to write data to the specified 
 underlying output stream.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> out - the underlying output stream.
    <dt> <b>See Also:</b>
    <dd> <a href="java.io.FilterOutputStream.html#out">out</a>
  </dl></dd>
</dl>
<a name="methods"></a>
<h2>
  <img src="images/methods.gif" width=151 height=38 alt="Methods">
</h2>
<a name="write(int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="write"><b>write</b></a>
<pre>
 public synchronized void write(int b) throws <a href="java.io.IOException.html#_top_">IOException</a>
</pre>
<dl>
  <dd> Writes the specified byte to the underlying output stream.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> b - the <code>byte</code> to be written.
    <dt> <b>Throws:</b> <a href="java.io.IOException.html#_top_">IOException</a>
    <dd> if an I/O error occurs.
    <dt> <b>Overrides:</b>
    <dd> <a href="java.io.FilterOutputStream.html#write(int)">write</a> in class <a href="java.io.FilterOutputStream.html#_top_">FilterOutputStream</a>
    <dt> <b>See Also:</b>
    <dd> <a href="java.io.FilterOutputStream.html#out">out</a>
  </dl></dd>
</dl>
<a name="write(byte[], int, int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="write"><b>write</b></a>
<pre>
 public synchronized void write(byte b[],
                                int off,
                                int len) throws <a href="java.io.IOException.html#_top_">IOException</a>
</pre>
<dl>
  <dd> Writes <code>len</code> bytes from the specified byte array 
 starting at offset <code>off</code> to the underlying output stream.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> b - the data.
    <dd> off - the start offset in the data.
    <dd> len - the number of bytes to write.
    <dt> <b>Throws:</b> <a href="java.io.IOException.html#_top_">IOException</a>
    <dd> if an I/O error occurs.
    <dt> <b>Overrides:</b>
    <dd> <a href="java.io.FilterOutputStream.html#write(byte[], int, int)">write</a> in class <a href="java.io.FilterOutputStream.html#_top_">FilterOutputStream</a>
    <dt> <b>See Also:</b>
    <dd> <a href="java.io.FilterOutputStream.html#out">out</a>
  </dl></dd>
</dl>
<a name="flush()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="flush"><b>flush</b></a>
<pre>
 public void flush() throws <a href="java.io.IOException.html#_top_">IOException</a>
</pre>
<dl>
  <dd> Flushes this data output stream. This forces any buffered output 
 bytes to be written out to the stream. 
 <p>
 The <code>flush</code> method of <code>DataOuputStream</code> 
 calls the <code>flush</code> method of its underlying output stream.
<p>
  <dd><dl>
    <dt> <b>Throws:</b> <a href="java.io.IOException.html#_top_">IOException</a>
    <dd> if an I/O error occurs.
    <dt> <b>Overrides:</b>
    <dd> <a href="java.io.FilterOutputStream.html#flush()">flush</a> in class <a href="java.io.FilterOutputStream.html#_top_">FilterOutputStream</a>
    <dt> <b>See Also:</b>
    <dd> <a href="java.io.FilterOutputStream.html#out">out</a>, <a href="java.io.OutputStream.html#flush()">flush</a>
  </dl></dd>
</dl>
<a name="writeBoolean(boolean)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="writeBoolean"><b>writeBoolean</b></a>
<pre>
 public final void writeBoolean(boolean v) throws <a href="java.io.IOException.html#_top_">IOException</a>
</pre>
<dl>
  <dd> Writes a <code>boolean</code> to the underlying output stream as 
 a 1-byte value. The value <code>true</code> is written out as the 
 value <code>(byte)1</code>; the value <code>false</code> is 
 written out as the value <code>(byte)0</code>.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> v - a <code>boolean</code> value to be written.
    <dt> <b>Throws:</b> <a href="java.io.IOException.html#_top_">IOException</a>
    <dd> if an I/O error occurs.
    <dt> <b>See Also:</b>
    <dd> <a href="java.io.FilterOutputStream.html#out">out</a>
  </dl></dd>
</dl>
<a name="writeByte(int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="writeByte"><b>writeByte</b></a>
<pre>
 public final void writeByte(int v) throws <a href="java.io.IOException.html#_top_">IOException</a>
</pre>
<dl>
  <dd> Writes out a <code>byte</code> to the underlying output stream as 
 a 1-byte value.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> v - a <code>byte</code> value to be written.
    <dt> <b>Throws:</b> <a href="java.io.IOException.html#_top_">IOException</a>
    <dd> if an I/O error occurs.
    <dt> <b>See Also:</b>
    <dd> <a href="java.io.FilterOutputStream.html#out">out</a>
  </dl></dd>
</dl>
<a name="writeShort(int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="writeShort"><b>writeShort</b></a>
<pre>
 public final void writeShort(int v) throws <a href="java.io.IOException.html#_top_">IOException</a>
</pre>
<dl>
  <dd> Writes a <code>short</code> to the underlying output stream as two
 bytes, high byte first.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> v - a <code>short</code> to be written.
    <dt> <b>Throws:</b> <a href="java.io.IOException.html#_top_">IOException</a>
    <dd> if an I/O error occurs.
    <dt> <b>See Also:</b>
    <dd> <a href="java.io.FilterOutputStream.html#out">out</a>
  </dl></dd>
</dl>
<a name="writeChar(int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="writeChar"><b>writeChar</b></a>
<pre>
 public final void writeChar(int v) throws <a href="java.io.IOException.html#_top_">IOException</a>
</pre>
<dl>
  <dd> Writes a <code>char</code> to the underlying output stream as a 
 2-byte value, high byte first.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> v - a <code>char</code> value to be written.
    <dt> <b>Throws:</b> <a href="java.io.IOException.html#_top_">IOException</a>
    <dd> if an I/O error occurs.
    <dt> <b>See Also:</b>
    <dd> <a href="java.io.FilterOutputStream.html#out">out</a>
  </dl></dd>
</dl>
<a name="writeInt(int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="writeInt"><b>writeInt</b></a>
<pre>
 public final void writeInt(int v) throws <a href="java.io.IOException.html#_top_">IOException</a>
</pre>
<dl>
  <dd> Writes an <code>int</code> to the underlying output stream as four
 bytes, high byte first.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> v - an <code>int</code> to be written.
    <dt> <b>Throws:</b> <a href="java.io.IOException.html#_top_">IOException</a>
    <dd> if an I/O error occurs.
    <dt> <b>See Also:</b>
    <dd> <a href="java.io.FilterOutputStream.html#out">out</a>
  </dl></dd>
</dl>
<a name="writeLong(long)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="writeLong"><b>writeLong</b></a>
<pre>
 public final void writeLong(long v) throws <a href="java.io.IOException.html#_top_">IOException</a>
</pre>
<dl>
  <dd> Writes a <code>long</code> to the underlying output stream as eight
 bytes, high byte first.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> v - a <code>long</code> to be written.
    <dt> <b>Throws:</b> <a href="java.io.IOException.html#_top_">IOException</a>
    <dd> if an I/O error occurs.
    <dt> <b>See Also:</b>
    <dd> <a href="java.io.FilterOutputStream.html#out">out</a>
  </dl></dd>
</dl>
<a name="writeFloat(float)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="writeFloat"><b>writeFloat</b></a>
<pre>
 public final void writeFloat(float v) throws <a href="java.io.IOException.html#_top_">IOException</a>
</pre>
<dl>
  <dd> Converts the float argument to an <code>int</code> using the 
 <code>floatToIntBits</code> method in class <code>Float</code>, 
 and then writes that <code>int</code> value to the underlying 
 output stream as a 4-byte quantity, high byte first.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> v - a <code>float</code> value to be written.
    <dt> <b>Throws:</b> <a href="java.io.IOException.html#_top_">IOException</a>
    <dd> if an I/O error occurs.
    <dt> <b>See Also:</b>
    <dd> <a href="java.io.FilterOutputStream.html#out">out</a>, <a href="java.lang.Float.html#floatToIntBits(float)">floatToIntBits</a>
  </dl></dd>
</dl>
<a name="writeDouble(double)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="writeDouble"><b>writeDouble</b></a>
<pre>
 public final void writeDouble(double v) throws <a href="java.io.IOException.html#_top_">IOException</a>
</pre>
<dl>
  <dd> Converts the double argument to a <code>long</code> using the 
 <code>doubleToLongBits</code> method in class <code>Double</code>, 
 and then writes that <code>long</code> value to the underlying 
 output stream as an 8-byte quantity, high byte first.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> v - a <code>double</code> value to be written.
    <dt> <b>Throws:</b> <a href="java.io.IOException.html#_top_">IOException</a>
    <dd> if an I/O error occurs.
    <dt> <b>See Also:</b>
    <dd> <a href="java.io.FilterOutputStream.html#out">out</a>, <a href="java.lang.Double.html#doubleToLongBits(double)">doubleToLongBits</a>
  </dl></dd>
</dl>
<a name="writeBytes(java.lang.String)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="writeBytes"><b>writeBytes</b></a>
<pre>
 public final void writeBytes(<a href="java.lang.String.html#_top_">String</a> s) throws <a href="java.io.IOException.html#_top_">IOException</a>
</pre>
<dl>
  <dd> Writes out the string to the underlying output stream as a 
 sequence of bytes. Each character in the string is written out, in 
 sequence, by discarding its high eight bits.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> s - a string of bytes to be written.
    <dt> <b>Throws:</b> <a href="java.io.IOException.html#_top_">IOException</a>
    <dd> if an I/O error occurs.
    <dt> <b>See Also:</b>
    <dd> <a href="java.io.FilterOutputStream.html#out">out</a>
  </dl></dd>
</dl>
<a name="writeChars(java.lang.String)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="writeChars"><b>writeChars</b></a>
<pre>
 public final void writeChars(<a href="java.lang.String.html#_top_">String</a> s) throws <a href="java.io.IOException.html#_top_">IOException</a>
</pre>
<dl>
  <dd> Writes a string to the underlying output stream as a sequence of 
 characters. Each character is written to the data output stream as 
 if by the <code>writeChar</code> method.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> s - a <code>String</code> value to be written.
    <dt> <b>Throws:</b> <a href="java.io.IOException.html#_top_">IOException</a>
    <dd> if an I/O error occurs.
    <dt> <b>See Also:</b>
    <dd> <a href="#writeChar(int)">writeChar</a>, <a href="java.io.FilterOutputStream.html#out">out</a>
  </dl></dd>
</dl>
<a name="writeUTF(java.lang.String)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="writeUTF"><b>writeUTF</b></a>
<pre>
 public final void writeUTF(<a href="java.lang.String.html#_top_">String</a> str) throws <a href="java.io.IOException.html#_top_">IOException</a>
</pre>
<dl>
  <dd> Writes a string to the underlying output stream using UTF-8 
 encoding in a machine-independent manner. 
 <p>
 First, two bytes are written to the output stream as if by the 
 <code>writeShort</code> method giving the number of bytes to 
 follow. This value is the number of bytes actually written out, 
 not the length of the string. Following the length, each character 
 of the string is output, in sequence, using the UTF-8 encoding 
 for the character.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> str - a string to be written.
    <dt> <b>Throws:</b> <a href="java.io.IOException.html#_top_">IOException</a>
    <dd> if an I/O error occurs.
  </dl></dd>
</dl>
<a name="size()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="size"><b>size</b></a>
<pre>
 public final int size()
</pre>
<dl>
  <dd> Returns the number of bytes written to this data output stream.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> the value of the <code>written</code> field.
    <dt> <b>See Also:</b>
    <dd> <a href="#written">written</a>
  </dl></dd>
</dl>
<hr>
<pre>
<a href="packages.html">All Packages</a>  <a href="tree.html">Class Hierarchy</a>  <a href="Package-java.io.html">This Package</a>  <a href="java.io.DataInputStream.html#_top_">Previous</a>  <a href="java.io.File.html#_top_">Next</a>  <a href="AllNames.html">Index</a></pre>
</body>
</html>
