Android程序设计第6章 媒介与网络.pptVIP

  • 3
  • 0
  • 约3.17万字
  • 约 70页
  • 2020-01-17 发布于辽宁
  • 举报
6.4 HTTP和URL网络资源获取 以下是使用HttpURLConnectino访问网络资源的标准流程: 1 //http地址 2 String httpUrl = http://www,; 3 StringBuffer buffer = new StringBuffer(); 4 String line = null; 5 BufferedReader reader = null; 6 HttpURLConnection urlConn=null; 7 try{ 8 //创建URL对象 9 URL url = new URL(httpUrl); 10 //通过URL对象创建一个HttpURLConnection对象 11 urlConn=(HttpURLConnection) url.openConnection(); 12 //得到读取内容的输入流 13 InputStream in = new InputStreamReader(urlConn.getInputStream()); 14 reader = new BufferedReader (in); * 6.4 HTTP和URL网络资源获取 以下是使用HttpURLConnectino访问网络资源的标准流程: 15 while((line =

文档评论(0)

1亿VIP精品文档

相关文档