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

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

© yshshe1700 初级黑马   /  2019-4-3 22:20  /  518 人查看  /  0 人回复  /   0 人收藏 转载请遵从CC协议 禁止商业使用本文

  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. }
复制代码

0 个回复

您需要登录后才可以回帖 登录 | 加入黑马