din.readLine()过时吗

zytang 2002-03-28 06:51:01
StringBuffer contentPage = new StringBuffer();
String nextLine = new String();
java.io.DataInputStream din = new DataInputStream(urlConn.getInputStream()); //从urlConn中取得流

while ((nextLine = din.readLine())!=null)
{
contentPage.append(nextLine+"\n");
}
din.close();


---------------
编译是说din.readLine()已经过时,
那该用什么方法在不过时呢
...全文
167 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
TigerChen 2002-03-29
  • 打赏
  • 举报
回复
不知道你用的jdk是多少版本的?据我的印象好像jdk1.1以上的版本,java.io.DataInputStream:
readLine() is deprecated.

你可以这样子来替换这句java.io.DataInputStream din = new DataInputStream(urlConn.getInputStream()); 用
BufferedReader din
= new BufferedReader(new InputStreamReader(urlConn.getInputStream()));
bread213 2002-03-29
  • 打赏
  • 举报
回复
试着将String nextLine = new String();
改为String nextLine = null;或String nextLine;
pilishine 2002-03-29
  • 打赏
  • 举报
回复
换个编译系统试试
zytang 2002-03-29
  • 打赏
  • 举报
回复
???
zytang 2002-03-29
  • 打赏
  • 举报
回复
??
zytang 2002-03-28
  • 打赏
  • 举报
回复
??

23,407

社区成员

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

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