标签:io
public static void doCopy(String PrimaryAddress, String NewAddress) { FileInputStream fis = null; FileOutputStream fos = null; try { fis = new FileInputStream(new File(PrimaryAddress)); fos = new FileOutputStream(new File(NewAddress)); byte [] buf = new byte[1024]; int len = 0; while((len = fis.read(buf)) != -1) { fos.write(buf, 0, len); fos.flush(); } } catch (Exception e) { System.err.println("文件复制失败!"); }finally{ try { if(fis != null) { fis.close(); } } catch (Exception e2) { // TODO: handle exception } try { if(fos != null) { fos.close(); } } catch (Exception e2) { // TODO: handle exception } } }
标签:io
原文地址:http://blog.csdn.net/cs_12/article/details/40039307