标签: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();
}
}
标签:stream except ace close dwr tst red reader buffered
原文地址:https://www.cnblogs.com/YRSWBY2016/p/12019199.html