package cn.io.transstream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
public class TransStreamDemo3 {
public static void main(String[] args) throws IOException {
//write();
read();
}
private static void read() throws IOException {
InputStreamReader isr = new InputStreamReader(new FileInputStream("utf.txt"),"utf-8");
char[] buf = new char[1024];
int len = isr.read(buf);
String str = new String(buf,0,len);
System.out.println(str);
}
private static void write() throws IOException {
OutputStreamWriter os = new OutputStreamWriter(new FileOutputStream("utf.txt"),"utf-8");
os.write("你好");
os.close();
}
}