public static void main(String[] args) throws IOException { OutputStreamWriter osw = new OutputStreamWriter(new FileOutputStream("a.txt"), Charset.forName("utf-8")); osw.write("张三"); osw.close(); InputStreamReader isr = new InputStreamReader(new FileInputStream("a.txt"), Charset.forName("utf-8")); int len; while ((len = isr.read()) != -1) { System.out.println((char)len); } isr.close(); }
标签:转换,InputStreamWriter,isr,Charset,len,OutputStreamReader,osw,new From: https://www.cnblogs.com/weiduaini/p/17206855.html