public class T {
public static void main (String[] args)throws Exception{
FileReader fr=new FileReader(“1.txt”);
char[ ] c=new char[1024];
int len=0;
while((len=fr.read©)!=-1){
//len为字符串数组长度,new String(c,0,len)即写入字符数组c,从0到数组长度写入新的字符串;
System.out.println(new String(c,0,len));
new String(c,0,len);
}
fr.close( );
}
}
字符缓冲输出流的用法
最新推荐文章于 2022-07-20 00:16:02 发布