public class Page3 { /** * 装饰者设计模式 * InputStream为父类下面有7个直接子类 * FileInputStream ByteArrayInputStream StringBufferInputStream * PipedInputStream ObjectInputStream SequenceInputStream * FilterInputStream * FilterInputStream下有三个修饰类 * BufferedInputStream DataInputStream PushbackInputStream * @param args * @throws Exception */ public static void main(String[] args)throws Exception{ InputStream fis1=new FileInputStream("E:\\jar\\often\\web.xml"); InputStream bis=new BufferedInputStream(fis1); byte[] buf1=new byte[1024]; while ((temp=bis.read(buf1))!=-1){ System.out.println("bufferedInputStream:"+new String(buf1,0,100)); } fis1.close(); } }
时间: 2024-09-29 10:51:21