import java.io.*;
public class ConversionStreamDome01 {
public static void main(String[] args) throws IOException {
//字符输出流
OutputStreamWriter osw = new OutputStreamWriter(new FileOutputStream
("D:\\IDEA\\src\\JavaHeiMa02\\src\\字符流CharStream\\字符输出流输入流\\osw.txt"),"UTF-8");//"JBK"
osw.write("李晨飞");
osw.close();
InputStreamReader isr = new InputStreamReader(new FileInputStream
("D:\\IDEA\\src\\JavaHeiMa02\\src\\字符流CharStream\\字符输出流输入流\\osw.txt"),"UTF-8");//"JBk"
//字符流一次读取一个字符
int ch;
while ((ch=isr.read())!=-1){
System.out.print((char) ch);
}
//字符流一次读取一个数组
char[] chars = new char[1024];
int len;
while ((len=isr.read(chars))!=-1){
System.out.println(new String(chars,0,len));
}
isr.close();
}
}