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();
}
}
java控制码表来读入读出
最新推荐文章于 2024-03-28 11:02:00 发布