A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

© fmi110 高级黑马   /  2015-10-1 21:53  /  356 人查看  /  1 人回复  /   0 人收藏 转载请遵从CC协议 禁止商业使用本文

a
  1. import java.io.BufferedInputStream;
  2. import java.io.BufferedOutputStream;
  3. import java.io.FileInputStream;
  4. import java.io.FileOutputStream;
  5. import java.io.IOException;


  6. public class T16 {

  7.         /**
  8.          * 16、使用带缓冲功能的字节流复制文件。
  9.          * @throws IOException
  10.          */
  11.         public static void main(String[] args) throws IOException {
  12.                 BufferedInputStream bin = new BufferedInputStream(new FileInputStream("c:\\ReflectDemo2.java"));
  13.                 BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream("F:\\copy.java"));
  14.                 byte[] bys = new byte[1024];
  15.                 int len;
  16.                 while((len=bin.read(bys))!=-1){
  17.                         bos.write(bys,0,len);
  18.                         bos.flush();
  19.                 }
  20.                 System.out.println("done");
  21.         }

  22. }
复制代码


1 个回复

倒序浏览
666666666666666666666666
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 加入黑马