字节流写出中文。

FileOutputStream fos = new FileOutputStream ("zzz.txt");

fos.write("我读书少,你不要骗我".getBytes()); //将字符串转换为字节数组,然后写出

fos.write("\r\n"getBytes());  //换到下一行

fos.write("我读书少,你知道吗".getBytes());  // 在第二行显示

fos.close();

posted @ 2020-06-17 21:57  一块  阅读(161)  评论(0编辑  收藏  举报