Java IO: FilterInputStream

Jakob Jenkov
Last update: 2014-11-16

The FilterInputStream is a base class for implementing your own filtering input streams. Basically it just overrides all methods in InputStream and passes all calls to any method on the FilterInputStream onto a wrapped InputStream. The wrapped InputStream is passed to the FilterInputStream in its constructor, like this:

FilterInputStream inputStream = new FilterInputStream(new FileInputStream("c:\\myfile.txt"));

The FilterInputStream class does not have any special behaviour. It is intended to be a base class for your own subclasses, but in my opinion you might as well just subclass InputStream directly.

Personally, I see no sensible purpose for this class. I cannot see that this class actually adds or changes any behaviour in InputStream except that it takes an InputStream in its constructor.

Jakob Jenkov

Featured Videos

Java ForkJoinPool

P2P Networks Introduction


Java Persistence
Close TOC
All Tutorial Trails
All Trails
Table of contents (TOC) for this tutorial trail
Trail TOC
Table of contents (TOC) for this tutorial
Page TOC
Previous tutorial in this tutorial trail
Next tutorial in this tutorial trail