java.net.URL例子
来源:互联网 发布:淘宝直播右下角的心 编辑:程序博客网 时间:2024/05/29 03:15
/**
* 网页内容获取
* @throws IOException
*/
public void getWebContext() throws IOException {
InputStream in;
URL url = new URL("http://localhost:8080/");
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection = (HttpURLConnection) url.openConnection();
// 模拟成IE
connection.setRequestProperty("User-Agent",
"Mozilla/4.0 (compatible; MSIE 6.0; Windows 2000)");
// connection.connect();
in = connection.getInputStream();
BufferedReader breader = new BufferedReader(new InputStreamReader(in,
"GBK"));
String str = breader.readLine();
while (str != null) {
System.out.println(str);
str = breader.readLine();
}
}
- java.net.URL例子
- java URL例子
- java.net.url
- java.net解析URL
- java.net.URL 练习
- java.net.URL
- java.net 类 URL
- java.net.url对象
- Java.NET小例子
- java.net.URL的URL构建方式
- Java处理url的的例子(http)
- java URL和URLConnection的例子
- java.net.URL类详解
- java.net.URL类详解
- .net 调用Java Webservice 例子
- java调用.net服务例子
- RESTful Java client with java.net.URL
- java.net.URL和org.apache.struts2.components.URL
- C++中的零散重要知识点
- 从【各大软件公司笔试压轴题】学习SQL语句
- Zenoss
- Secure Software Installation on Smartphones 笔记
- 11年上班的第一天,老板要我换部门或是换公司。
- java.net.URL例子
- JAVA之——GC
- 一个简单的arm开发板的制作过程
- 我的c语言之旅--4
- 写在开学前,假期尾巴处
- 养儿方知父母心
- linux常用命令(不断更新)
- POI读取Excel(兼容Excel2003、Excel2007)
- 找工作的几个方法