public static void fileCopy2Buffer(String oldFileName,String newFileName){ BufferedReader br = null; BufferedWriter bw = null; try { br = new BufferedReader(new FileReader(oldFileName)); bw = new BufferedWriter(new FileWriter(newFileName)); String str = null; while ((str = br.readLine())!=null){ bw.write(str); bw.newLine(); } }catch (Exception e){ e.printStackTrace(); }finally { try { if(bw!=null)br.close(); if(br!=null)bw.close(); }catch (Exception ee){ ee.printStackTrace(); } } }