Chapter    4

Streams

Along with java.io.File and java.io.RandomAccessFile, Java’s classic I/O infrastructure provides streams for performing I/O operations. A stream is an ordered sequence of bytes of an arbitrary length. Bytes flow over an output stream from an application to a destination and flow over an input stream from a source to an application.

Java provides classes in the java.io package that identify various stream destinations for writing; for example, byte arrays, files, and thread pipes. Java also provides classes in this package that identify various stream sources for reading. Examples include byte arrays, files, and thread pipes. This chapter explores many of these classes.

Stream Classes Overview

The java.io package provides ...

Get Java I/O, NIO and NIO.2 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.