A URI (Unform resources Identifier) is a Uniform resource identifier that uniquely identifies a resource, which is a URI for a resource. Consists of four parts, the protocol, the host domain name of the resource, the resource file name, the port number.
The URL (unform Resource Locator) is a Uniform Resource locator and is a specific URI. You can think of a URL as a "pointer" to an Internet resource.
The resource file name contains the file path, usually a relative path, relative to the app you are accessing. The java.net package has a URL class that provides a number of constructor methods, a URL ("Http://www.baidu.com:80/index.html#a?uname=xiaoming") with a parameter, an absolute path creation, where # is an anchor, Represents a jump within an HTML page,? After is the user information, throws the exception is malformedurlexception, the parameter writes the not and the specification will throw this exception, the malformed URL.
There are also two parameters of the constructor, URL (url,string), take parameter 1 of the protocol, domain name, port number, reject path, plus parameter 2 relative path, left slash/behind is relative path. The URL ("http://www.baidu.com:80/index.html#a?uname=xiaoming", b.html) gets the http://www.baidu.com:80/b.html.
View protocol: Getprotocol () View relative path resource GetPath (), relative to host name, with more
View Host Name: GetHost () get Anchor Point Getref ()
View Port: Getport () Gets the user input parameter getquery () if there is an anchor point, the parameter is treated as part of the anchor, and the return is null
View resources: GetFile ()
This object can also get HTML page specific information OpenStream (), this method is the focus. HTML page consists of four parts, HTML tags for formatting data, CSS skin for landscaping data, JS for interactive data, data.
The OpenStream method returns a inputstream that links the byte input stream for the specified resource. The output stream input stream is not always clear, remember that in is the Readin read, read is the link to the resources read to a place, out is written write, link to the resources do not have to write things, is from somewhere to write things to the linked resources, write
java.net the URL class in the package