Input Output : Introduction « File « Java Tutorial

There are four types of streams: InputStream, OutputStream, Reader, and Writer.

  1. Reader. A stream to read characters.
  2. Writer. A stream to write characters.
  3. InputStream. A stream to read binary data.
  4. OutputStream. A stream to write binary data.

For better performance, use the buffered I/O classes: BufferedInputStream, BufferedOutputStream, BufferedReader, and BufferedWriter.

Reading from and writing to a stream dictate that you do so sequentially. The is for non-sequential operations.

For object serialization and deserialization, you can use the ObjectInputStream and ObjectOutputStream classes.

11.1.1.Input Output
11.1.2.Reading Binary Data
11.1.3.Writing Binary Data