Java_URL

本文详细介绍了如何使用Java的URL和URLConnection类来访问远程网站,包括构造URL对象、理解URI与URL的区别,并提供了实例代码演示。

###Making URL Connections
To access web servers in a Java program, you will want to work on a higher level than making a socket connection and issuing HTTP requests. In the following sections, we discuss the classes that the Java library provides for this purpose. ####URLs and URIs The URL and URLConnection classes encapsulate much of the complexity of retrieving information from a remote site. You can construct a URL object from a string: URL url = new URL(urlString);

A URI is a purely syntactical construct that contains the various parts of the string specifying a web resource. A URL is a special kind of URI, namely, one with sufficient information to locate a resource. Other URIs, such as mailto:cay@horstmann.com are not locators—there is no data to locate from this identifier. Such a URI is called a URN (uniform resource name).

转载于:https://my.oschina.net/LosersAFC/blog/213447

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值