本帖最后由 陌路行者 于 2013-7-17 17:05 编辑
- import java.io.*;
- class CopyPic1
- {
- public static void main(String[] args) throws IOException
- {
- FileInputStream fis = new FileInputStream("1.jpg");
- FileOutputStream fos = new FileOutputStream("2.jpg");
- byte[] buf = new byte[1024];
- int len=0;
- while((len=fis.read(buf))!=-1)
- {
- fos.write(buf,0,len);
- }
- fis.close();
- fos.close();
- }
- }
复制代码 |