黑马程序员技术交流社区

标题: 【成都效区Javaee24期】 [打印本页]

作者: yshshe1700    时间: 2019-4-3 22:20
标题: 【成都效区Javaee24期】
  1. package day10;

  2. import java.io.*;

  3. public class Test001 {
  4.     public static void main(String[] args) throws IOException {
  5.         //创建高效字节流读取数据
  6.         BufferedInputStream bis = new BufferedInputStream(new FileInputStream("C:\\IMG_3444.JPG"));
  7.         //创建高效字节流写入数据
  8.         BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream("D:\\jape.jpg"));
  9.        byte[] by =new byte[1024];
  10.         int line;
  11.         while ((line = bis.read(by))!=-1){
  12.             bos.write(by,0,line);
  13.         }
  14.         bos.close();
  15.         bis.close();
  16.     }
  17. }
复制代码





欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) 黑马程序员IT技术论坛 X3.2