为什么 Android Volley Response String 这么短

Why Android Volley Response String is so short

当我使用Android Volley 从网络中拉取Web HTML 信息时,我发现响应字符串太短了,我无法获取下面有用的info.Code:

private static void requestTest(RequestQueue mQueue) {
    StringRequest stringRequest = new StringRequest("http://www.baidu.com/",new Response.Listener<String>() {
        @Override
        public void onResponse(String s) {
            Log.v(TAG,"s length="+s.length());   **//Here i Found the length is 7619,it's too short**
            Log.v(TAG,"s="+s.toString());  /**/To Display s on the Console I found the s did not contain the all Info of the web.**
        }
    },new Response.ErrorListener() {
        @Override
        public void onErrorResponse(VolleyError volleyError) {

        }
    });
    mQueue.add(stringRequest);
}

谁知道这个问题,请告诉我!非常感谢!

您只能在单个日志消息中记录 ~4k 个字符。您尝试记录的长度是 7k,因此它被截断了。 easiest/quickest 解决方法只是将消息拆分为多个 logcat 条目,例如:

for( String line : s.split("\n") ) {
    Log.d( TAG, line );
}