解析 JSON 数据时出现此异常:
org.apache.http.MalformedChunkCodingException:分块流意外结束
在 org.apache.http.impl.io.ChunkedInputStream.getChunkSize
任何人都可以建议我该怎么做...我正在阅读流:
HttpPost request = new HttpPost(url);
StringBuilder sb=new StringBuilder();
request.getParams().setParameter(CoreProtocolPNames.USE_EXPECT_CONTINUE, Boolean.FALSE);
request.setHeader("Accept", "application/json");
HttpResponse response =null;
DefaultHttpClient httpClient = new DefaultHttpClient();
//DefaultHttpClient httpClient = getNewHttpClient();
HttpConnectionParams.setSoTimeout(httpClient.getParams(), timeOut);
HttpConnectionParams.setConnectionTimeout(httpClient.getParams(),timeOut);
response = httpClient.execute(request);
InputStream in = response.getEntity().getContent();
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
String line = null;
while((line = reader.readLine()) != null){
sb.append(line);
}
resultString = sb.toString();