一次读取一个字符:
</pre><pre name="code" class="java">FileReader fr = new FileReader("fw.txt");
int ch =0;
while((ch=fr.read())!=-1){
System.out.print((char)ch);
}
fr.close();
一次读取一组字符:
<pre name="code" class="java">FileReader fr = new FileReader("fw.txt");
int len = 0;
char[] chs = new char[1024];
while((len=fr.read(chs))!=-1){
System.out.print(String.valueOf(chs,0,len));
fr.close();
}