码迷,mamicode.com
首页 > 其他好文 > 详细

文件IO流的修饰者设计模式

时间:2017-06-03 14:08:29      阅读:126      评论:0      收藏:0      [点我收藏+]

标签:rgs   static   array   param   puts   filter   void   system   pre   

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();
    }
}

  

文件IO流的修饰者设计模式

标签:rgs   static   array   param   puts   filter   void   system   pre   

原文地址:http://www.cnblogs.com/test1234/p/6937018.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!