package com.class0417_1;
import java.io.*;
/**
* @author Administrator
* 功能:图片复制
*/
public class Test1_peciur_copy {
public static void main(String[] args) throws IOException {
// TODO 自动生成的方法存根
File file1 = new File("C:/87143-102.jpg");
File file2 = new File("D:/123.jpg");
//创建输入通道
FileInputStream fileInputStream1 = new FileInputStream(file1);
//创建输出通道
FileOutputStream fileInputStream2 = new FileOutputStream(file2,true);
byte[] buf = new byte[1024];
int length = 0;
while((length = fileInputStream1.read(buf))!=-1){
fileInputStream2.write(buf,0,length);
}
fileInputStream1.close();
fileInputStream2.close();
}
}
JAVA_IO_复制图片
最新推荐文章于 2021-02-20 20:19:26 发布