I suppose you are talking about java.io.Filter* (like FilterInputStream).
If we talk about the FilterInputStream class, it is simply a wrapper around an InputStream that does nothing. Every call to a method of the Filter will simply call the corresponding method on the wrapped InputStream. Alone, it is quite useless.
Imagine that you want an InputStream that transforms every "a" character into a "b". You could extend FilterInputStream and override the read() methods :
// this code has not been tested
class ABFilter extends FilterInputStream {
public ABFilter (InputStream in) {
super(in);
}
@Override
public int read() {
int character = super.read();
if (character == 97)
return 98;
return character;
}
// similarly implement all other "read()" methods
}
Now you can use this stream to wrap any existing stream :
InputStream streamWithA = ...;
InputStream streamWithoutA = new FilterInputStream(streamWithA);