java_25.1字节转为字符OutputStreamWriter

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 @ 2019-04-16 15:02  CHAHN  阅读(105)  评论(0编辑  收藏  举报