FileOutputStream s = new FileOutputStream("abc.txt");
OutputStreamWriter w = new OutputStreamWriter(s, "utf-8");
PrintWriter pw = new PrintWriter(w);
pw.println("陈abc");
pw.flush();
pw.close();
如果使用系统默认的编码,可以用FileWriter/FileReader类比较方便.
本文转自 dogegg250 51CTO博客,原文链接:http://blog.51cto.com/jianshusoft/652068,如需转载请自行联系原作者