Decorator intentAttachadditional responsibilities to an object dynamically. decorators provide aflexible alternative to subclassing for extending funible ality dynamically adds some functions for a class, which is more flexible than using inheritance interfaces for objects that can have responsibilities added to them dynamically. define the function interface ConcreteComponentdefines an object to which additional responsibilities can be attached for specific implementation of the Deco Function Ratormaintainsa reference to a Component object and defines an interface that conforms toComponent's interface holds the component reference and defines the function interface ConcreteDecoratoradd sresponsibilities to the component. added the Consequence effect for component More flexibility than static inheritance. lots of little objects is more flexible than static inheritance. A design that uses Decorator often results in systems composed of lots of little objects that all look alike. Requires fewer objects. This results in a large number of small objects. Correlation mode • Ad a p t e r mode: D e c o r a t o r mode is different from A d a p t e r mode, because decoration only changes the responsibility of an object without changing its interface, the adapter will give the object a new interface. • Co m p o s I t e mode: decoration can be viewed as a degraded combination of only one component. However, decoration only adds some additional responsibilities to an object-it does not aim at object aggregation. • St r a t e g y mode: You can use a decoration to change the appearance of an object, while the S t r a t e g y mode allows you to change the kernel of an object. This is two ways to change objects. By observing the FileInputStream constructor, JDK-InputStream does not belong to decorator. JDK-Reader Analysis