android 网络请求获得返回数据(1)
来源:互联网 发布:男科网络咨询说话技巧 编辑:程序博客网 时间:2024/04/26 14:43
public class test{ public static void main(String args[]) throws Exception { URL u=new URL("http://xxxxxxxx"); InputStream in=u.openStream(); ByteArrayOutputStream out=new ByteArrayOutputStream(); try { byte buf[]=new byte[1024]; int read = 0; while ((read = in.read(buf)) > 0) { out.write(buf, 0, read); } } finally { if (in != null) { in.close(); } } byte b[]=out.toByteArray( ); System.out.println(new String(b,"utf-8")); }}
public class test{ public static void main(String args[]) throws Exception { URL u=new URL("http://api.k780.com:88/?app=weather.history&weaid=城市编号(1)&date=查询的日期(2015-07-20)&appkey={APPKEY}&sign={SIGN}&format=json"); InputStream in=u.openStream(); ByteArrayOutputStream out=new ByteArrayOutputStream(); try { byte buf[]=new byte[1024]; int read = 0; while ((read = in.read(buf)) > 0) { out.write(buf, 0, read); } } finally { if (in != null) { in.close(); } } byte b[]=out.toByteArray( ); System.out.println(new String(b,"utf-8")); }}
0 0
- android 网络请求获得返回数据(1)
- Java读取Url请求获得返回数据
- Android使用HttpURLConnection请求网络返回JSON数据并解析
- android网络数据请求
- 请求网络数据返回json串
- Android下网络请求数据,返回数据显示不全,解析json no value for xxx
- Android请求网络数据在部分手机上出现没有数据返回的情况
- android HttpURLConnection网络请求数据
- android 请求网络数据 HttpURLConnection
- Android-网络请求数据AsyncTask
- android使用asynchttp网络请求服务器返回json数据并显示在手机
- Android 请求WebService返回SoapObject数据解析
- Android开发笔记之get请求方式获得网络图片
- Android post请求网络数据(json作为参数)
- Android post网络数据请求(本人新手版本)
- Android学习之网络请求(访问网路数据)一
- httpRequest网络请求数据返回中文编码解决
- 关于网络请求返回数据是nil的情况
- 推荐系统中常用算法 以及优点缺点对比
- Initializing Spring root WebApplicationContext log4j:WARN No appenders couould be found for logger (
- mysql索引与范式
- 数据结构之双向链表(C语言实现)
- NULL¬ NULL
- android 网络请求获得返回数据(1)
- spring boot 整合 spring security 之使用数据库验证
- android post请求
- DB2 C language external scalar user-defined function
- C::有趣的约瑟夫环
- 最大子矩阵(贪心)
- iOS 10 开发适配系列 之 权限Crash问题
- NOIP2016 总结
- DB2 how to drop overloaded functions