First page Back Continue Last page Overview Graphics
Source vs. Filter streams
All Filter streams implement the Decorator design pattern and can therefore be connected to any source stream.
This is a very neat and useful example of how a design pattern actually allows extended functionallity and resuability.
Note however, that a decorator can never be used on its own. It will always be dependant on its enclosed component (or stream in our case) for receiving/sending the actual bytes/chars.
Decorators can also be chained on to another – or recursively applied. This is called chaining