Reading and Writing Data Using Byte Streams

There are many different types of streams within the Java API. Each type of stream within the Java API is represented by a different Java class or interface. The InputStream and OutputStream classes represent the simplest of the byte stream classes. These two classes provide general streaming capabilities for byte data. Java uses these base classes to derive other classes that are more specifically oriented toward a certain type of input or output. You can find all the various stream classes in the java.io package. Here are a few of the available streams for byte data:

  • BufferedInputStream — A basic buffered input stream

  • DataInputStream — An input stream for reading primitive data types

Get Special Edition Using Java 2 Standard Edition 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.