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

Core Software Performance Optimization Principles


Java Persistence
Close TOC

All Trails

Trail TOC

Page TOC