public static void CreateFile(String src,String des){
String path1="D:\\test\\data\\"+src;
String path2="D:\\test\\res\\"+des;
File file1=new File(path1);
//StringBuilder sb=new StringBuilder();
File file2=new File(path2);
try {
if(!file2.exists()){
file2.createNewFile();
}
BufferedReader br=new BufferedReader(new FileReader(file1));
String line=br.readLine();
BufferedWriter bw=new BufferedWriter(new FileWriter(file2,true));
while(line!=null){
bw.write(line+"\r\n");
line=br.readLine();
}
br.close();
bw.flush();
bw.close();
} catch (IOException e) {
e.printStackTrace();
}
}
时间: 2024-10-05 11:18:02