String s = "我爱你中国";
OutputStreamWriter osw = new OutputStreamWriter(new FileOutputStream("ac1.txt"), "gbk");
BufferedWriter bufferedWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream("ac.txt"), "gbk"));
bufferedWriter.write(s);
osw.write(s);
osw.close();
bufferedWriter.close();
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(new FileInputStream("ac1.txt"), "gbk"));
String len;
while ((len = bufferedReader.readLine()) != null) {
System.out.println(len);
}
bufferedReader.close();
原文地址:http://blog.51cto.com/357712148/2348685
时间: 2024-10-20 03:01:04