- import java.io.*;
- class Demo
- {
- public static void main(String[] args) throws Exception
- {
- BufferedInputStream bufis=new BufferedInputStream(new FileInputStream("1.jpg"));
- BufferedOutputStream bufos=new BufferedOutputStream(new FileOutputStream("2.jpg"));
- byte[] buf=new byte[1024];
- int len=0;
- while ((len=bufis.read(buf))!=-1)
- {
- bufos.write(buf,0,len);
- bufos.flush();
- }
- bufos.close();
- bufis.close();
- }
- }
复制代码 |
|