package com.hk.domain;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
public class Copypic {
/**
* 复制图片
*/
public static void main(String[] args) {
FileInputStream fin =null;
FileOutputStream fos = null;
int i = 0;
try{
fin = new FileInputStream("D:\\我的文档\\图片\\http_imgload2.jpg");
fos = new FileOutputStream("D:\\我的文档\\图片\\http_imgload3.jpg");
while((i=fin.read())!= -1){
fos.write(i);//读了一定要有写的方法。切忌!
}
}catch (FileNotFoundException e){
e.printStackTrace();
}catch (IOException e){
e.printStackTrace();
}finally {
try{
if (null != fos){
fos.close();
}
}catch (IOException e){
e.printStackTrace();
}
try{
if(null != fin){
fin.close();
}
}catch (IOException e){
e.printStackTrace();
}
}
}
}