java_25.1字节转为字符OutputStreamWriter

1
2
3
4
5
6
7
8
9
10
11
12
public class Demo {
    public static void main(String[] args){
        try {
            FileOutputStream fos = new FileOutputStream("d:\\aaa.txt");
            OutputStreamWriter sow = new OutputStreamWriter(fos,"UTF-8");
            sow.write("hello world");
            sow.close();
        }catch(Exception e){
            e.printStackTrace();
        }
    }
}

 

posted @   CHAHN  阅读(105)  评论(0编辑  收藏  举报
努力加载评论中...
点击右上角即可分享
微信分享提示