public class URLString
extends java.lang.Object
implements java.io.Serializable
A URL should be in the form
<protocol>://<user:password>@<host:port>/<path>#ref
Example:
Does almost the same thing as URLName
but is serializable so it can be used
over JMX. The only difference is within the getURL()
method where a / prefix will be
added to the file name for non file url.
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
fullURL
The full version of the URL
|
Modifier | Constructor and Description |
---|---|
protected |
URLString() |
|
URLString(java.io.File file)
Construct a URLString from a java.io.File object.
|
|
URLString(java.lang.String url)
Construct a URLString from the string.
|
|
URLString(java.lang.String protocol,
java.lang.String host,
int port,
java.lang.String file,
java.lang.String username,
java.lang.String password)
Creates a URLString object from the specified protocol, host, port number, file, username, and
password.
|
|
URLString(java.net.URL url)
Construct a URLString from a java.net.URL object.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
java.lang.String |
getFile()
Returns the file name of this URLString.
|
java.lang.String |
getHost()
Returns the host of this URLString.
|
java.lang.String |
getPassword()
Returns the password of this URLString.
|
int |
getPort()
Returns the port number of this URLString.
|
java.lang.String |
getProtocol()
Returns the protocol of this URLString.
|
java.lang.String |
getRef()
Returns the reference of this URLString.
|
java.net.URL |
getURL()
Constructs a URL from the URLString.
|
java.lang.String |
getUsername()
Returns the user name of this URLString.
|
int |
hashCode()
Compute the hash code for this URLString.
|
java.lang.String |
toString()
Constructs a string representation of this URLString.
|
protected URLString()
public URLString(java.lang.String protocol, java.lang.String host, int port, java.lang.String file, java.lang.String username, java.lang.String password)
public URLString(java.net.URL url)
public URLString(java.io.File file) throws java.net.MalformedURLException
java.net.MalformedURLException
public URLString(java.lang.String url)
public java.lang.String toString()
toString
in class java.lang.Object
public int getPort()
public java.lang.String getProtocol()
public java.lang.String getFile()
public java.lang.String getRef()
public java.lang.String getHost()
public java.lang.String getUsername()
public java.lang.String getPassword()
public java.net.URL getURL() throws java.net.MalformedURLException
java.net.MalformedURLException
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object