File f=new File("C:\\cd.jpg");
if (!f.exists()){
throw new IOException("文件不存在");
}
FileInputStream fis=new FileInputStream(f);
FileOutputStream fos=new FileOutputStream("D:\\cd2.jpg");
DataInputStream dis=new DataInputStream(fis);
DataOutputStream dos=new DataOutputStream(fos);
byte[] bytes=new byte[dis.available()];
dis.read(bytes);
dos.write(bytes);
dis.close();
dos.close();
08-28
3411
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)