URLConnection类 示例
来源:互联网 发布:mac qq不显示群头像 编辑:程序博客网 时间:2024/06/05 18:23
//Demonstrate URLConnection.
import java.net.*;
import java.io.*;
import java.util.Date;
class URLConnectionDemo{
public static void main(String[] args) throws Exception{
int c;
URL hp = new URL("http://www.osborne.com");
URLConnection hpCon = hp.openConnection();
System.out.println("Date: " + new Date(hpCon.getDate()));
System.out.println("Content-Type: " + hpCon.getContentType());
System.out.println("Expires: " + hpCon.getExpiration());
System.out.println("Last-Modified: " + new Date(hpCon.getLastModified()));
int len = hpCon.getContentLength();
System.out.println("Content-Length: " + len );
if(len>0){
System.out.println("===== Content =====");
InputStream input = hpCon.getInputStream();
int i = len;
while((c= input.read())!=-1 && (--i>0)){
System.out.println((char)c);
}
input.close();
}else{
System.out.println("No Content Available.");
}
}
}
- URLConnection类 示例
- urlconnection示例
- JDK URLConnection示例
- URLConnection使用示例
- InetAddress类、URL类、URLConnection类解析及用法示例
- URLConnection类
- URLConnection类
- java网络编程四:InetAddress类、URL类、URLConnection类解析及用法示例
- java网络编程四:InetAddress类、URL类、URLConnection类解析及用法示例
- java网络编程四:InetAddress类、URL类、URLConnection类解析及用法示例
- java网络编程四:InetAddress类、URL类、URLConnection类解析及用法示例
- URL,URLConnection类
- java URLConnection类
- URLConnection
- URLConnection
- urlConnection
- URLConnection
- URLConnection
- 10000的阶乘的算法(大数的阶乘)
- 推荐一款思维导图工具:MindManager
- Excel单元格中公式和结果的互相转化Evaluate和Get.cell
- 世界杯第二十一天
- Sever Remote Control程序作品+源代码
- URLConnection类 示例
- 今天,我迟到了
- jar 命令简介(一)
- Datagrams 数据报 示例
- 一个视频专家
- 开博第一篇——通过修改.class文件来解除构建路径错误
- 人性化,想人所想……
- java中的事件机制(续)
- VB解压缩与压缩