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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.