Note that this class differs from java.net.URL
in that this class just represents the name of a URL, it does
not model the connection to a URL.
| Modifier and Type | Field and Description |
|---|---|
| pack-priv static final int | |
| private static boolean | doEncode
A way to turn off encoding, just in case... |
| pack-priv static BitSet | dontNeedEncoding
The class contains a utility method for converting a
|
| private String | file
The specified file name on that host. |
| protected String | fullURL
The full version of the URL |
| private int | hashCode
Our hash code. |
| private String | host
The host name to which to connect. |
| private InetAddress | hostAddress
The host's IP address, used in equals and hashCode. |
| private boolean | |
| private String | password
The password to use when connecting. |
| private int | port
The protocol port to connect to. |
| private String | protocol
The protocol to use (ftp, http, nntp, imap, pop3 ... |
| private String | ref
# reference. |
| private String | username
The username to use when connecting |
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| private static String | |
| pack-priv static String | |
| pack-priv static String | |
| public boolean | equals(Object
the reference object with which to compare. obj)Overrides java. |
| public String | |
| public String | |
| private synchronized InetAddress | |
| public String | |
| public int | |
| public String | |
| public String | |
| public URL | |
| public String | |
| public int | |
| private static int | indexOfAny(String s, String any)
Return the first index of any of the characters in "any" in "s", or -1 if none are found. |
| private static int | |
| protected void | parseString(String
the URL string to parse url)Method which does all of the work of parsing the string. |
| public String |
| caseDiff | back to summary |
|---|---|
| pack-priv static final int caseDiff | |
| doEncode | back to summary |
|---|---|
| private static boolean doEncode A way to turn off encoding, just in case... | |
| dontNeedEncoding | back to summary |
|---|---|
| pack-priv static BitSet dontNeedEncoding The class contains a utility method for converting a
To convert a
| |
| file | back to summary |
|---|---|
| private String file The specified file name on that host. | |
| fullURL | back to summary |
|---|---|
| protected String fullURL The full version of the URL | |
| hashCode | back to summary |
|---|---|
| private int hashCode Our hash code. | |
| host | back to summary |
|---|---|
| private String host The host name to which to connect. | |
| hostAddress | back to summary |
|---|---|
| private InetAddress hostAddress The host's IP address, used in equals and hashCode. Computed on demand. | |
| hostAddressKnown | back to summary |
|---|---|
| private boolean hostAddressKnown | |
| password | back to summary |
|---|---|
| private String password The password to use when connecting. | |
| port | back to summary |
|---|---|
| private int port The protocol port to connect to. | |
| protocol | back to summary |
|---|---|
| private String protocol The protocol to use (ftp, http, nntp, imap, pop3 ... etc.) . | |
| ref | back to summary |
|---|---|
| private String ref # reference. | |
| username | back to summary |
|---|---|
| private String username The username to use when connecting | |
| URLName | back to summary |
|---|---|
| public URLName(String protocol, String host, int port, String file, String username, String password) Creates a URLName object from the specified protocol, host, port number, file, username, and password. Specifying a port number of -1 indicates that the URL should use the default port for the protocol. | |
| URLName | back to summary |
|---|---|
| public URLName(URL url) Construct a URLName from a java.net.URL object.
| |
| URLName | back to summary |
|---|---|
| public URLName(String url) Construct a URLName from the string. Parses out all the possible information (protocol, host, port, file, username, password).
| |
| _encode | back to summary |
|---|---|
| private static String _encode(String s) | |
| decode | back to summary |
|---|---|
| pack-priv static String decode(String s) Decodes a "x-www-form-urlencoded" to a String. | |
| encode | back to summary |
|---|---|
| pack-priv static String encode(String s) Translates a string into | |
| equals | back to summary |
|---|---|
| public boolean equals(Object obj) Overrides java. Compares two URLNames. The result is true if and only if the argument is not null and is a URLName object that represents the same URLName as this object. Two URLName objects are equal if they have the same protocol and the same host, the same port number on the host, the same username, and the same file on the host. The fields (host, username, file) are also considered the same if they are both null. Hosts are considered equal if the names are equal (case independent) or if host name lookups for them both succeed and they both reference the same IP address. Note that URLName has no knowledge of default port numbers for particular protocols, so "imap://host" and "imap://host:143" would not compare as equal. Note also that the password field is not included in the comparison, nor is any reference field appended to the filename.
| |
| getFile | back to summary |
|---|---|
| public String getFile() Returns the file name of this URLName. Returns null if this URLName has no file name.
| |
| getHost | back to summary |
|---|---|
| public String getHost() Returns the host of this URLName. Returns null if this URLName has no host.
| |
| getHostAddress | back to summary |
|---|---|
| private synchronized InetAddress getHostAddress() Get the IP address of our host. Look up the name the first time and remember that we've done so, whether the lookup fails or not. | |
| getPassword | back to summary |
|---|---|
| public String getPassword() Returns the password of this URLName. Returns null if this URLName has no password.
| |
| getPort | back to summary |
|---|---|
| public int getPort() Returns the port number of this URLName. Returns -1 if the port is not set.
| |
| getProtocol | back to summary |
|---|---|
| public String getProtocol() Returns the protocol of this URLName. Returns null if this URLName has no protocol.
| |
| getRef | back to summary |
|---|---|
| public String getRef() Returns the reference of this URLName. Returns null if this URLName has no reference.
| |
| getURL | back to summary |
|---|---|
| public URL getURL() throws MalformedURLException Constructs a URL from the URLName.
| |
| getUsername | back to summary |
|---|---|
| public String getUsername() Returns the user name of this URLName. Returns null if this URLName has no user name.
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Compute the hash code for this URLName.
| |
| indexOfAny | back to summary |
|---|---|
| private static int indexOfAny(String s, String any) Return the first index of any of the characters in "any" in "s", or -1 if none are found. This should be a method on String. | |
| indexOfAny | back to summary |
|---|---|
| private static int indexOfAny(String s, String any, int start) | |
| parseString | back to summary |
|---|---|
| protected void parseString(String url) Method which does all of the work of parsing the string.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Constructs a string representation of this URLName.
| |