public static void main(String[] args) throws IOException { BufferedReader br=new BufferedReader(new InputStreamReader(new FileInputStream("d:\\2.txt"),"utf-8")); BufferedWriter bw=new BufferedWriter(new OutputStreamWriter(new FileOutputStream("d:\\3.txt"),"utf-8")); String str=null; while ((str=br.readLine())!=null){ System.out.println("str:"+str);
//写入文件 bw.write(str); bw.newLine(); }
//清除缓存 bw.flush();
//关闭流 br.close(); bw.close(); }