按指定编码(UTF-8)写入文件中

String filePath = "指定文件写入路径"; // 例如:D:\\files\\test.txt

BufferedWriter bw= new BufferedWriter (new OutputStreamWriter (new FileOutputStream (filePath,true),"UTF-8"));

bw.write("Hello China");

 

posted @ 2020-06-28 18:16  蛋挞小子  阅读(572)  评论(0编辑  收藏  举报