由以下代码读取一个网页:
try{
  URL u=new URL("http://www.sohu.com");
  URLConnection uc=u.openConnection();
  InputStream raw=uc.getInputStream();
  InputStream buffer=new BufferedInputStream(raw);
                   
   Reader r=new InputStreamReader(buffer);
   int c;
   while((c=r.read())!=-1)
         {
             System.out.print((char) c);
         } //end while
   }//end try
   catch (IOException e){
            System.err.println(e);
            }// end catch
 }// end main是不是有可能由于网速很慢,打开网页超时而进入异常处理。
若是这样,能否将超时时间设为无穷大,等到读完网页后再
继续往下运行!谢谢!