码迷,mamicode.com
首页 > 其他好文 > 详细

pipaxing

时间:2019-12-10 22:37:01      阅读:107      评论:0      收藏:0      [点我收藏+]

标签:stream   except   ace   close   dwr   tst   red   reader   buffered   

public class Three {
public static void main(String[] args) {
try{
changeEncoding("GBK","UTF-8","ccom\\xxdc\\琵琶行_GBK.txt","20190810\\琵琶行_UTF8.txt");
} catch (IOException e) {
e.printStackTrace();
}


}
public static void changeEncoding (String inEncoding, String outEncoding,
String inFileName, String outFileName) throws IOException {
BufferedReader reader = new BufferedReader(
new InputStreamReader(
new FileInputStream(inFileName), inEncoding));
BufferedWriter writer = new BufferedWriter(
new OutputStreamWriter(
new FileOutputStream(outFileName), outEncoding));
String s = null;
while ((s = reader.readLine()) != null) {
writer.write(s,0, s.length());
writer.newLine();
}
writer.flush();
writer.close();
reader.close();
}
}

pipaxing

标签:stream   except   ace   close   dwr   tst   red   reader   buffered   

原文地址:https://www.cnblogs.com/YRSWBY2016/p/12019199.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!