我有以下代码:
HttpClient FETCHER
HttpResponse response = FETCHER.execute(host, httpMethod);
我试图将其内容读取为这样的字符串:
HttpEntity entity = response.getEntity();
InputStream st = entity.getContent();
StringWriter writer = new StringWriter();
IOUtils.copy(st, writer);
String content = writer.toString();
问题是,当我获取http://www.google.co.in/页面时,传输编码被分块,我只得到第一个块。它一直提取到第一个“”。
我如何一次获得所有块,以便我可以转储完整的输出并对其进行一些处理?