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();
    }