android 中的 BuffredReader 不会读取整个 httpResponse



嗨,我有一个特定的url(给定),它被调用并正确地在浏览器中给出,但是当我在android中使用它时,它不提供完整的输出,它只是提供部分输出

URL url = new URL("http://www.livedatatunnel.com/httpsymbolhelper/default.aspx");
    HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
    try {
        InputStream in=urlConnection.getInputStream();
        urlConnection.connect();
        BufferedReader reader = new BufferedReader(new InputStreamReader(in),2500);
        String result="", line="";
        while((line=reader.readLine())!=null){
            result+=line;
        }
        urlConnection.disconnect();
        System.out.println(result);
        return result;
    }catch(Exception e){
        e.printStackTrace();
        return null;
    }finally {
        urlConnection.disconnect();
    }
}

请帮忙...

您应该提供连接超时和/或读取超时。

最新更新