为什么BufferedReader只能读取第一行
代码如下:
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(
new FileInputStream("hd1.txt")));
line = reader.readLine();
System.out.println(line);
if(line == null)
return "文件为空!";
//else {
if(line != null){
StringTokenizer stringTokenizer = new StringTokenizer(line,"\u5639\u563b");
while(stringTokenizer.hasMoreTokens()){
String phone = stringTokenizer.nextToken();
String[] phoneInfo = phone.split(",");
String tempNumber = phoneInfo[1].substring(1,phoneInfo[1].length()-1);
//System.out.println(phone);
if(tempNumber.equals(phoneNumber.substring(0,7))){
cityName = phoneInfo[0].substring(1,phoneInfo[0].length()-1);
break;
}
}
}
reader.close();
} catch(IOException ioe) {
ioe.printStackTrace();
}
hd1.txt文件:
"col001","col002","mobileflag","id"
"阿坝","1388248","qqt",1
"阿坝","1388249","qqt",2
"阿坝","1399040","qqt",3
"阿坝","1399041","qqt",4
"阿坝","1399042","qqt",5
为社么读取到hd1.txt文件的第一行?