import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
public class Main1{
public static void main(String args[]){
// 原始状态下,只有tutu1.jpg文件
File src = new File("F:\\haha","tutu1.jpg");
File dist = new File("F:\\haha","tutu2.jpg");
try {
//现在要读源文件src即输入流,写到目的文件dist即输出流。
FileInputStream in = new FileInputStream(src);
FileOutputStream out = new FileOutputStream(dist);
byte[] b = new byte[1024];
int n=-1;
while((n=in.read(b))!=-1){
out.write(b, 0, n);
out.flush();
}
out.close();
in.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}