Data Stream Classes

The java.io.DataInputStream and java.io.DataOutputStream classes read and write primitive Java data types and Strings in a machine-independent way. Generally you use a DataInputStream to read data written by a DataOutputStream. This format uses IEEE 754 for floating point data, big-endian format for integer data, and a modified UTF-8 for Unicode data.

DataOutputStream declares these methods:

 public DataOutputStream(OutputStream out)
 public synchronized void write(int b) throws IOException
 public synchronized void write(byte[] data, int offset, int length) 
  throws IOException
 public final void writeBoolean(boolean b) throws IOException
 public final void writeByte(int b) throws IOException
 public final void writeShort(int s) throws IOException
 public final void writeChar(int c) throws IOException
 public final void writeInt(int i) throws IOException
 public final void writeFloat(float f) throws IOException
 public final void writeDouble(double d) throws IOException
 public final void writeBytes(String s) throws IOException
 public final void writeChars(String s) throws IOException
 public final void writeUTF(String s) throws IOException
 public final int size()
 public void flush() throws IOException
 
The size() method returns the number of bytes written to this data output stream.


Previous | Next | Top
Last Modified July 6, 1999
Copyright 1997, 1999 Elliotte Rusty Harold
elharo@metalab.unc.edu