HttpClient client = new DefaultHttpClient();
HttpGet request = new HttpGet();
request.setURI(new URI(address));
HttpResponse response = client.execute(request);
BufferedReader in = new BufferedReader(new
InputStreamReader(response.getEntity().getContent()));
当我检索这样的信息时,bufferedreader in只包含一个带有整个文本的长行。它不会将中断数据划分为多行。结果,只有前3个字符合适用于该行,其余的则被丢失。我该如何避免这个问题?
答案 0 :(得分:1)
简单
URL url = new URI(address).toURL();
InputStream is = url.openStream();
答案 1 :(得分:0)
你试试这个吗?
String data = EntityUtils.toString(response.getEntity());