Byte Streams

All byte streams are either a subclass of InputStream or OutputStream. These classes are abstract, so you cannot create a stream by creating objects of these classes directly. Instead, you create streams through one of their subclasses, such as the following:

  • FileInputStream and FileOutputStream—Byte streams stored in files on disk, CD-ROM, or other storage devices.

  • DataInputStream and DataOutputStream—A filtered byte stream from which data such as integers and floating-point numbers can be read.

InputStream is the superclass of all input streams.

File Streams

The byte streams you work with most are likely to be file streams, which are used to exchange data with files on your disk drives, CD-ROMs, or other storage devices you can refer ...

Get Sams Teach Yourself Java 2 in 21 Days, Second 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.