您的位置:首页 > 其它

文本文件的读取方式二

2015-07-01 11:16 281 查看
package collection;

import java.io.*;

import java.util.*;

public class Demo1 {

 /**

  * @param args

  * @throws IOException

  * @throws IOException

  */

 public static void main(String[] args) throws IOException  {

  

  FileReader fr = new FileReader("F:\\demo.txt");

 

  char[] buf = new char[1024];

  

  int num = 0;

  while((num = fr.read(buf))!=-1){

   sop(new String(buf,0,num));

  }

 }

 private static void sop(Object string) {

  System.out.println(string);

 }

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: