装饰模式(Decorator)最常见的就是JDK中的关于文件流的处理。
DataInputStream dis = = new DataInputStream(new BufferedInputStream(new FileInputStream("test.txt")));
装饰模式的类图如下:
装饰模式(Decorator)最常见的就是JDK中的关于文件流的处理。
DataInputStream dis = = new DataInputStream(new BufferedInputStream(new FileInputStream("test.txt")));
装饰模式的类图如下: