- public static void reabuf()throws IOException
- {
- FileReader fr=new FileReader("lin.txt");
- BufferedReader bufr=new BufferedReader(fr);
- String s=null;
- while((s=bufr.readLine())!=null)
- {
- System.out.println(s);
- }
- bufr.close();
- }
- public static void rea() throws IOException
- {
- FileReader fr=new FileReader("lin.txt");
- char[] ch=new char[1024];
- int c=0;
- while((c=fr.read(ch))!=-1)
- {
- System.out.print(new String(ch,0,c));
- }
- }
复制代码 以上两个函数功能相同,BufferedReader功能是不是代替了定义的 char[] ch=new char[1024];?
|
|