首页 > 编程语言 > 详细

java通过编码读取文件

时间:2019-02-03 22:56:02      阅读:172      评论:0      收藏:0      [点我收藏+]
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();

java通过编码读取文件

原文:http://blog.51cto.com/357712148/2348685

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!