大家都去拿这个代码去试一下,为什么我这个不能拷贝,换成png格式的图片就可以拷贝- import java.io.*;
- class IOCopyPicDemo
- {
- public static void main(String[] args) throws IOException
- {
- FileInputStream fis = new FileInputStream("pic1.jpeg");
- FileOutputStream fos = new FileOutputStream("pic2");
- byte[] buf = new byte[1024];
- int len = -1;
- while( (len = fis.read(buf)) != -1)
- {
- fos.write(buf,0,len);
- }
- fis.close();
- fos.close();
-
- }
- }
复制代码 |