字节流复制图片

package com.czie.iot1913.lps.IO.InPutStream;

import java.io.FileInputStream;
import java.io.FileOutputStream;

/**
* FileName: CopyJpgDemo
* Author: lps
* Date: 2022/3/24 19:03
* Sign:刘品水 Q:1944900433
*/
public class CopyJpgDemo {
public static void main(String[] args) throws Exception {
FileInputStream fis = new FileInputStream("E:\\itcast\\hh.jpg");

FileOutputStream fos = new FileOutputStream("F:\\JavaCode\\hh.jpg");

byte[] bys = new byte[1024];
int len;
while ((len=fis.read(bys))!=-1){
fos.write(bys,0,len);
}
fis.close();
fos.close();

}
}

 

posted @ 2022-03-24 19:14  刘品水  阅读(26)  评论(0编辑  收藏  举报