http://www.verejava.com/?id=16994676228912
package com.io; import java.io.*; public class TestCopy { public static void main(String[] args) { InputStream is=null; OutputStream os=null; try { //读取文件 english.txt is=new FileInputStream(new File("res/1.png")); //实列化一个写入流 os=new FileOutputStream(new File("res/copy.png")); int l; //一边读 一边写入 while((l=is.read())!=-1) { os.write(l); } } catch (Exception e) { e.printStackTrace(); } finally { try { is.close(); os.close(); } catch (IOException e) { e.printStackTrace(); } } } }
http://www.verejava.com/?id=16994676228912