java 文件操作(拷贝一个文件)

java 文件操作(拷贝一个文件)

try
{

  BufferedReader in = new BufferedReader(new FileReader("c:\\1.txt"));
  PrintWriter writer = new PrintWriter(new BufferedWriter(new FileWriter("c:\\2.txt")),true);
  String tmp = "";
  while((tmp=in.readLine()) != null)
  {
    writer.println(tmp);
  }
  writer.close();
  in.close();
}
catch(Exception e)
{
e.printStackTrace();
}

你可能感兴趣的:(java 文件操作(拷贝一个文件))