What is the decorator pattern
Carried out without disrupting the business logic of the enhanced decorative multilayer decorative support, and proxy mode decorator like to focus on strengthening, focusing control agent
Java IO
Class Diagram
use
// the FileInputStream file stream is read into class for the InputStream in = new new the FileInputStream ( "/ User / wangzheng / test.txt" ); // is a class with a cache read data support function implemented in decorating cache increases with the InputStream bin = new new BufferedInputStream (in); byte [] = Data new new byte [128 ]; the while (! bin.read (Data) = -1 ) { // ... }