httpClient怎么取得编码的问题
1个回答
展开全部
取得编码,你时说去的服务器返回数据吗?
参考代码:
HttpClient client = new DefaultHttpClient();
HttpGet httpget = new HttpGet(url); //填入请求的url
try{
HttpResponse response = client.execute(httpget);
InputStream input = response.getEntity().getContent(); //getContent()可以以输入流的形式获取返回内容。
int b;
while((b = input) != -1){
//读取返回值
}
}catch(Sock...
catch(IOEx...
//后边有几个exception,手打不写了
参考代码:
HttpClient client = new DefaultHttpClient();
HttpGet httpget = new HttpGet(url); //填入请求的url
try{
HttpResponse response = client.execute(httpget);
InputStream input = response.getEntity().getContent(); //getContent()可以以输入流的形式获取返回内容。
int b;
while((b = input) != -1){
//读取返回值
}
}catch(Sock...
catch(IOEx...
//后边有几个exception,手打不写了
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询