final class URL implements Serializable

Purpose

bullet Represent a Universal Resource Locator (i.e., a Web resource).

Class method summary

bullet static void setURLStreamHandlerFactory(URLStreamHandlerFactory f)
bullet Sets the URLStreamHandlerFactory of the program to f.

Constructor Summary

bullet URL(String s)
bullet Constructs a new URL object using s.
bullet URL(String p, String h, int n, String f)
bullet Constructs a new URL object using protocol p, host h, port number n, and file f.
bullet URL(String p, String h, int n, String f, URLStreamHandler u)
bullet Constructs a new URL object using protocol p, host h, port number n, file f, and handler u.
bullet URL(String p, String h, String f)
bullet Constructs a new URL object using protocol p, host h, and file f.
bullet URL(URL u, String s)
bullet Constructs a new URL object by using s within URL context u.
bullet URL(URL u, String s, URLStreamHandler h)
bullet Constructs a new URL object by using s with handler h within URL context u.

Instance method summary

bullet boolean equals(Object v)
bullet Returns true if and only if v is an instance of URL specifying the same Web resource.
bullet String getAuthority()
bullet Returns the authority of this URL.
bullet Object getContent()
bullet Returns the contents of this URL.
bullet Object getContent(Class[] t)
bullet Returns the first contents of this URL that matches a type in t.
bullet int getDefaultPort()
bullet Returns the default port number of the protocol associated with this URL.
bullet String getFile()
bullet Returns the file name of this URL.
bullet String getHost()
bullet Return the host name of this URL.
bullet String getPath()
bullet Returns the path of this URL.
bullet int getPort()
bullet Returns the port number of this URL.
bullet String getProtocol()
bullet Returns the protocol of this URL.
bullet String getQuery()
bullet Returns the query part of this URL.
bullet String getRef()
bullet Returns the anchor of this URL.
bullet String getUserInfo()
bullet Returns the user information of this URL.
bullet int hashCode()
bullet Returns the hash code of this URL.
bullet URLConnection openConnection()
bullet Returns a URLConnection representing a connection to the Web resource represented by this URL.
bullet InputStream openStream()
bullet Returns an InputStream for reading the opened connection to this URL.
bullet boolean sameFhile(URL u)
bullet Returns true if this URL is the same as u excluding their fragment components; otherwise, returns false.  
bullet protected void set(String p, String h, int n, String f, String r)  
bullet Sets the protocol, host, port number, file, and internal reference fields of this URL to respectively p, h, n, f, and r.  
bullet protected void set(String p, String h, int n, String a, String u, String path, String q, String r)  
bullet Sets the protocol, host, port number, authority, user information, file, query, and internal reference fields of this URL to respectively p, h, n, a, u, f, q, and r.  
bullet String toExternalForm()  
bullet Returns a String representation of the value of this URL.  
bullet String toString()
bullet Returns a String representation of the value of this URL.