首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > J2EE开发 >

奇怪了。求解,该如何处理

2013-10-18 
奇怪了。。。。求解public ListString FileInputStreamDemo(String path) throws IOException{File filenew

奇怪了。。。。求解
    public List<String> FileInputStreamDemo(String path) throws IOException{
        File file=new File(path);
        if(!file.exists()||file.isDirectory())
            throw new FileNotFoundException();
        FileReader reader = new FileReader(path);
        BufferedReader fis = new BufferedReader(reader,800000);
        List<String> list = new ArrayList<String>();
        while(fis.readLine()!=null){
            list.add(fis.readLine());
        }
        return list;
    }

我用上面代码读取一个3M多的文件,直接运行不出数据,但是把断点点在while判断时,再运行数据又出来了,在线求解,求大神
[解决办法]
while(fis.readLine()!=null){
   list.add(fis.readLine());
}

这还没问题?
[解决办法]
String s = "";
while((s=fis.readLine())!=null){
      if(s != "" && !"".equals(s))
      {
            list.add(s);
       }
}

热点排行