OutputStream : Introduction « File « Java Tutorial






The OutputStream class defines three write method overloads, which are mirrors of the read method overloads in InputStream:

public void write (int b)
public void write (byte[] data)
public void write (byte[] data, int offset, int length)
  1. The first overload writes the lowest 8 bits of the integer b to this OutputStream.
  2. The second writes the content of a byte array to this OutputStream.
  3. The third overload writes length bytes of the data starting at offset offset.
  1. close() method closes the OutputStream.
  2. flush() method forces any buffered content to be written out to the sink.








11.1.Introduction
11.1.1.Input Output
11.1.2.Reading Binary Data
11.1.3.Writing Binary Data
11.1.4.OutputStream