字节转字符 OutputStreamWriter
package cn.lideng.demo4; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.OutputStreamWriter; //字节转字符 public class OutputStreamWriterDemo { public static void main(String[] args) { writeUTF(); } public static void writeUTF(){ try { //字节 FileOutputStream fos=new FileOutputStream("d:\\t.txt"); //字符 OutputStreamWriter os=new OutputStreamWriter(fos,"utf-8"); os.write("您好"); os.close(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } }