URL url = new URL("https://www.baidu.com");
public URL(String protocol,String host,String file)
public URL(String protocol,String host,int port,String file)
pubillc URL(URL context,String spec)
URL url = new URL("https","www.baidu.com","/s/123");
// https://www.baidu.com/s/123
new URL(url,"456");
// https://www.baidu.com/s/456
new URL(url,"/p/123");
// https://www.baidu.com/p/123
3、理解 URL 的 getter 方法
4、从 URL 对象获取数据
public URLConnection openConnection()
public final Object getContent()
public final InputStream openStream()
//获得得数据是URL引用得原始内容,因此可能是ASCII文本、HTML二进制图片数据等
5、URL 的 equals()方法
6、创建 URI 对象
7、理解 URI 的 getter 方法
8、掌握 URI 的 resolve()和 relativize()方法
9、理解 URI 的 equals()方法和 toString()方法
10、理解 URI 的 isAbsolute()和 isOpaque()方法
原文:https://www.cnblogs.com/IamHzc/p/14881842.html