WEB开发网
开发学院手机开发Android 开发 Android 解析 socket 或 http 流中文编码 阅读

Android 解析 socket 或 http 流中文编码

 2010-02-27 01:34:00 来源:WEB开发网   
核心提示:public String getHttpContent(String htmlurl) throws Exception{HttpClient hc = new DefaultHttpClient();HttpGet get = new HttpGet(htmlUrl);HttpResponse rp = hc.ex

public String getHttpContent(String htmlurl) throws Exception{

HttpClient hc = new DefaultHttpClient();

HttpGet get = new HttpGet(htmlUrl);

HttpResponse rp = hc.execute(get);

if (rp.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {

return EntityUtils.toString(rp.getEntity()).trim();

}else{

return null;

}

}

apache的这些类用起来还真是方便,以后还要多多学习

Tags:Android 解析 socket

编辑录入:coldstar [复制链接] [打 印]
赞助商链接