android中的BufferedReader并没有读取整个httpResponse

时间:2013-09-25 11:43:18

标签: android httpresponse bufferedreader

嗨我有特定的url(Given)被调用并在浏览器中正确放出但是我在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();
    }
}

请帮忙......

1 个答案:

答案 0 :(得分:0)

您应该提供connect time out和/或reading time out