Utis类
来源:互联网 发布:山东临沂外包淘宝客服 编辑:程序博客网 时间:2024/06/07 07:42
public class NetUtils {
public static Reader getDataByGet(String path){
InputStreamReader isr = null;
try {
URL url = new URL(path);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
int code = conn.getResponseCode();
if(code == 200){
InputStream is = conn.getInputStream();
isr = new InputStreamReader(is);
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return isr;
}
}
public static Reader getDataByGet(String path){
InputStreamReader isr = null;
try {
URL url = new URL(path);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
int code = conn.getResponseCode();
if(code == 200){
InputStream is = conn.getInputStream();
isr = new InputStreamReader(is);
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return isr;
}
}
阅读全文
0 0
- Utis类
- Xcode 4 Document Types and Exported UTIs
- Public UTIs supported by Mac OS X v10.3
- 类
- 类
- 类
- 类
- 类
- 类
- 类
- 类
- 类
- 类
- 类
- 类
- 类
- 类
- 类
- 2017年暑假组队训练赛-No.2 F
- java 集合的概念以及集合框架介绍
- 英语帝国建立记
- JNI开发基础系列--JNI一些基本概念
- storm-kafka源码分析
- Utis类
- 圣杯布局和双飞翼布局
- 挂断电话流程分析
- TensorFlow在windows环境下的安装(1)
- 试题库问题 最大流 输出方案
- Shared_ptr详解
- opencv学习心得
- 微信ios版本的两个灰度功能和一些小改变
- 2017-8-13