import java.io.*;
public class Demo04 {
public static void main(String[] args) throws IOException {
InputStreamReader fileIn = new InputStreamReader(new FileInputStream("G:\\Java\\测试文件夹\\我是GBK格式的文本.txt"),"GBK");
OutputStreamWriter fileOut = new OutputStreamWriter(new FileOutputStream("G:\\Java\\测试文件夹\\我是utf_8格式的文件.txt"),"UTF-8");
int len=0;
while ((len=fileIn.read())!=-1){
fileOut.write(len);
fileOut.flush();
}
fileIn.close();
fileOut.close();
}
}
来源:CSDN
作者:Mango学习日记
链接:https://blog.csdn.net/wangzilong1995/article/details/104107526