奇怪的问题,请大家看看!!

cxj_2000 2001-11-16 09:50:09
我做FTP的时候:发现:
public int getResponseCode(BufferedReader bufferrdreader)
{
String s = "" ;
String s1 = null;
int ResponseCode;
try
{
while((s1 = bufferrdreader.readLine()) != null)
{
s = s + s1 ;
System.out.println(s);
}
System.out.println(s);
ResponseCode = Integer.parseInt(s.substring(0,3));
}
catch (IOException w)
{
ResponseCode = -1;
}
ResponseCode = Integer.parseInt(s.substring(0,3));
return ResponseCode;
}
按理说:readLine()读到最后的时候就是一个null。这段代码应该可以完成的,可以程序到这里就停了,好像readLine()在等服务器发来的数据一样,请那位大哥指正,谢谢
...全文
40 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
cxa_2002 2002-07-31
  • 打赏
  • 举报
回复
你写详细一点,我来看看

62,612

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧