SunONE Application Server v8.0 PE

javax.mail
Class URLName

java.lang.Object
  extended byjavax.mail.URLName

public class URLName
extends java.lang.Object

The name of a URL. This class represents a URL name and also provides the basic parsing functionality to parse most internet standard URL schemes.

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.

Version:
1.15, 02/03/27
Author:
Christopher Cotton, Bill Shannon

Field Summary
protected  java.lang.String fullURL
          The full version of the URL
 
Constructor Summary
URLName(java.lang.String url)
          Construct a URLName from the string.
URLName(java.lang.String protocol, java.lang.String host, int port, java.lang.String file, java.lang.String username, java.lang.String password)
          Creates a URLName object from the specified protocol, host, port number, file, username, and password.
URLName(java.net.URL url)
          Construct a URLName from a java.net.URL object.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Compares two URLNames.
 java.lang.String getFile()
          Returns the file name of this URLName.
 java.lang.String getHost()
          Returns the host of this URLName.
 java.lang.String getPassword()
          Returns the password of this URLName.
 int getPort()
          Returns the port number of this URLName.
 java.lang.String getProtocol()
          Returns the protocol of this URLName.
 java.lang.String getRef()
          Returns the reference of this URLName.
 java.net.URL getURL()
          Constructs a URL from the URLName.
 java.lang.String getUsername()
          Returns the user name of this URLName.
 int hashCode()
          Compute the hash code for this URLName.
protected  void parseString(java.lang.String url)
          Method which does all of the work of parsing the string.
 java.lang.String toString()
          Constructs a string representation of this URLName.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

fullURL

protected java.lang.String fullURL
The full version of the URL

Constructor Detail

URLName

public URLName(java.lang.String protocol,
               java.lang.String host,
               int port,
               java.lang.String file,
               java.lang.String username,
               java.lang.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

public URLName(java.net.URL url)
Construct a URLName from a java.net.URL object.


URLName

public URLName(java.lang.String url)
Construct a URLName from the string. Parses out all the possible information (protocol, host, port, file, username, password).

Method Detail

toString

public java.lang.String toString()
Constructs a string representation of this URLName.


parseString

protected void parseString(java.lang.String url)
Method which does all of the work of parsing the string.


getPort

public int getPort()
Returns the port number of this URLName. Returns -1 if the port is not set.


getProtocol

public java.lang.String getProtocol()
Returns the protocol of this URLName. Returns null if this URLName has no protocol.


getFile

public java.lang.String getFile()
Returns the file name of this URLName. Returns null if this URLName has no file name.


getRef

public java.lang.String getRef()
Returns the reference of this URLName. Returns null if this URLName has no reference.


getHost

public java.lang.String getHost()
Returns the host of this URLName. Returns null if this URLName has no host.


getUsername

public java.lang.String getUsername()
Returns the user name of this URLName. Returns null if this URLName has no user name.


getPassword

public java.lang.String getPassword()
Returns the password of this URLName. Returns null if this URLName has no password.


getURL

public java.net.URL getURL()
                    throws java.net.MalformedURLException
Constructs a URL from the URLName.

Throws:
java.net.MalformedURLException

equals

public boolean equals(java.lang.Object obj)
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 reference the same host, the same port number on the host, the same username and password, and the same file on the host. The fields (host, username, password, file) are also considered the same if they are both null.


hashCode

public int hashCode()
Compute the hash code for this URLName.


SunONE Application Server v8.0 PE

Submit a bug or feature

Copyright 2003 Sun Microsystems, Inc. All rights reserved.