如何读取HTTP输入流?

12 浏览
0 Comments

如何读取HTTP输入流?

下面的代码是从Javadocs上HttpURLConnection复制而来的。

我遇到了以下错误:

readStream(in) 

...因为没有这样的方法。

URLConnection.getInputStream的类概述中也有同样的情况。

readStream在哪里?以下是提供的代码片段:

 URL url = new URL("http://www.android.com/");   
    HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();   
    try 
    {     
        InputStream in = new BufferedInputStream(urlConnection.getInputStream());     
        readStream(in);  <-----没有这样的方法
    }
    finally 
    {     
        urlConnection.disconnect();   
    } 

0