Example usage for Java java.net URL fields, constructors, methods, implement or subclass
The text is from its open source code.
URL(String spec) Creates a URL object from the String representation. | |
URL(String protocol, String host, int port, String file) Creates a URL object from the specified protocol , host , port number, and file . host can be expressed as a host name or a literal IP address. | |
URL(String protocol, String host, String file) Creates a URL from the specified protocol name, host name, and file name. | |
URL(URL context, String spec, URLStreamHandler handler) Creates a URL by parsing the given spec with the specified handler within a specified context. | |
URL(URL context, String spec) Creates a URL by parsing the given spec within a specified context. |
boolean | equals(Object obj) Compares this URL for equality with another object. If the given object is not a URL then this method immediately returns false . Two URL objects are equal if they have the same protocol, reference equivalent hosts, have the same port number on the host, and the same file and fragment of the file. Two hosts are considered equivalent if both host names can be resolved into the same IP addresses; else if either host name can't be resolved, the host names must be equal without regard to case; or both host names equal to null. Since hosts comparison requires name resolution, this operation is a blocking operation. |
String | getAuthority() Gets the authority part of this URL . |
Class> | getClass() Returns the runtime class of this Object . |
Object | getContent() Gets the contents of this URL. |
Object | getContent(Class>[] classes) Gets the contents of this URL. |
int | getDefaultPort() Gets the default port number of the protocol associated with this URL . |
String | getFile() Gets the file name of this URL . |
String | getHost() Gets the host name of this URL , if applicable. |
String | getPath() Gets the path part of this URL . |
int | getPort() Gets the port number of this URL . |
String | getProtocol() Gets the protocol name of this URL . |
String | getQuery() Gets the query part of this URL . |
String | getRef() Gets the anchor (also known as the "reference") of this URL . |
String | getUserInfo() Gets the userInfo part of this URL . |
URLConnection | openConnection() Returns a java.net.URLConnection URLConnection instance that represents a connection to the remote object referred to by the URL . |
URLConnection | openConnection(Proxy proxy) Same as #openConnection() , except that the connection will be made through the specified proxy; Protocol handlers that do not support proxying will ignore the proxy parameter and make a normal connection. |
InputStream | openStream() Opens a connection to this URL and returns an InputStream for reading from that connection. |
boolean | sameFile(URL other) Compares two URLs, excluding the fragment component. Returns true if this URL and the other argument are equal without taking the fragment component into consideration. |
void | setURLStreamHandlerFactory(URLStreamHandlerFactory fac) Sets an application's URLStreamHandlerFactory . |
String | toExternalForm() Constructs a string representation of this URL . |
String | toLowerCase(String protocol) Returns the protocol in lower case. |
String | toString() Constructs a string representation of this URL . |
URI | toURI() Returns a java.net.URI equivalent to this URL. |