java io
数据拷贝 public static void copyFile(File sourceFile,File targetFile) throws IOException{ BufferedInputStream inBuff=null; BufferedOutputStream outBuff=null; try{ //缓冲输入流 inBuff=new BufferedInputStream(new FileInputStream(sourceFile)); //缓冲输出流 outBuff=new BufferedOutputStream(new FileOutputStream(targetFile)); byte[] b=new byte[1024*5]; int len; while ((len=inBuff.read(b))!=-1) { outBuff.write(b,0,len); } } finally{ if(inBuff!=null){ inBuff.close(); } if(outBuff!=null){ outBuff.close(); } } }