Java.io.OutputStreamWriter.getEncoding() 方法 Java.io.OutputStreamWriter.flush() 方法 Java.io.OutputStreamWriter.write char() 方法 Java.io.OutputStreamWriter.getEncoding() 方法 package com.codingdict; import java.io.*; public class OutputStreamWriterDemo { public static void main(String[] args) { try { // create a new OutputStreamWriter OutputStream os = new FileOutputStream("test.txt"); OutputStreamWriter writer = new OutputStreamWriter(os); // create a new FileInputStream to read what we write FileInputStream in = new FileInputStream("test.txt"); // write something in the file writer.write(70); // flush the stream writer.flush(); // get and print the encoding for this stream System.out.println("" + writer.getEncoding()); // read what we write System.out.println("" + (char) in.read()); } catch (Exception ex) { ex.printStackTrace(); } } } Java.io.OutputStreamWriter.flush() 方法 Java.io.OutputStreamWriter.write char() 方法