4.3. Filter Streams

While the basic low-level streams provide a simple mechanism to read and write bytes of information, their flexibility is limited. After all, reading bytes is complex (for people, at least), and there's more to the world that just bytes of data. Text, for example, is a sequence of characters, and other forms of data like numbers take up more than a single byte. Byte-level communication can also be inefficient, and data buffering can improve performance. To overcome these limitations, filter streams are used.

Filter streams add additional functionality to an existing stream, by processing data in some form (such as buffering for performance) or offering additional methods that allow data to be accessed in a different manner ...

Get Java™ Network Programming and Distributed Computing 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.