|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
javax.mail Class URLName
java.lang.Object javax.mail.URLName
public class URLName
- extends Object
URL 的名称。此类表示一个 URL 名称,它还提供基本解析功能以解析大多数 Internet 标准 URL 方案。
注意,此类与 java.net.URL
的不同在于此类只表示 URL 名称,不模拟到 URL 的连接。
version | 1.19, 07/05/04 |
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.19, 07/05/04
- Author:
- Christopher Cotton, Bill Shannon
Field Summary | |
---|---|
protected String |
fullURL
The full version of the URL |
Constructor Summary | |
---|---|
URLName(String url)
Construct a URLName from the string. |
|
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. |
|
URLName(URL url)
Construct a URLName from a java.net.URL object. |
Method Summary | |
---|---|
boolean |
equals(Object obj)
Compares two URLNames. |
String |
getFile()
Returns the file name of this URLName. |
String |
getHost()
Returns the host of this URLName. |
String |
getPassword()
Returns the password of this URLName. |
int |
getPort()
Returns the port number of this URLName. |
String |
getProtocol()
Returns the protocol of this URLName. |
String |
getRef()
Returns the reference of this URLName. |
URL |
getURL()
Constructs a URL from the URLName. |
String |
getUsername()
Returns the user name of this URLName. |
int |
hashCode()
Compute the hash code for this URLName. |
protected void |
parseString(String url)
Method which does all of the work of parsing the string. |
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 String fullURL
- The full version of the URL
Constructor Detail |
---|
public
URLName(String protocol, String host, int port, String file, String username, String password)
根据指定协议、主机、端口号、文件、用户名和密码创建 URLName 对象。将端口号指定为 -1,指示 URL 应该使用协议的默认端口。
英文文档:
URLName
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.
public
URLName(java.net.URL url)
根据 java.net.URL 对象构造 URLName。
英文文档:
URLName
public URLName(URL url)
- Construct a URLName from a java.net.URL object.
public
URLName(String url)
根据字符串构造 URLName。解析出所有可能的信息(协议、主机、端口、文件、用户名和密码)。
英文文档:
URLName
public URLName(String url)
- Construct a URLName from the string. Parses out all the possible
information (protocol, host, port, file, username, password).
Method Detail |
---|
public String
toString()
构造此 URLName 的字符串表示形式。
英文文档:
toString
public String toString()
protected void
parseString(String url)
完成解析字符串的所有工作的方法。
英文文档:
parseString
protected void parseString(String url)
- Method which does all of the work of parsing the string.
public int
getPort()
返回此 URLName 的端口号。如果未设置端口,则返回 -1。
英文文档:
getPort
public int getPort()
- Returns the port number of this URLName.
Returns -1 if the port is not set.
public String
getProtocol()
返回此 URLName 的协议。如果此 URLName 没有协议,则返回 null。
英文文档:
getProtocol
public String getProtocol()
- Returns the protocol of this URLName.
Returns null if this URLName has no protocol.
public String
getFile()
返回此 URLName 的文件名。如果此 URLName 没有文件名,则返回 null。
英文文档:
getFile
public String getFile()
- Returns the file name of this URLName.
Returns null if this URLName has no file name.
public String
getRef()
返回此 URLName 的引用。如果此 URLName 没有引用,则返回 null。
英文文档:
getRef
public String getRef()
- Returns the reference of this URLName.
Returns null if this URLName has no reference.
public String
getHost()
返回此 URLName 的主机。如果此 URLName 没有主机,则返回 null。
英文文档:
getHost
public String getHost()
- Returns the host of this URLName.
Returns null if this URLName has no host.
public String
getUsername()
返回此 URLName 的用户名。如果此 URLName 没有用户名,则返回 null。
英文文档:
getUsername
public String getUsername()
- Returns the user name of this URLName.
Returns null if this URLName has no user name.
public String
getPassword()
返回此 URLName 的密码。如果此 URLName 没有密码,则返回 null。
英文文档:
getPassword
public String getPassword()
- Returns the password of this URLName.
Returns null if this URLName has no password.
public java.net.URL
getURL() throws java.net.MalformedURLException
根据 URLName 构造 URL。
英文文档:
getURL
public URL getURL() throws MalformedURLException
- Constructs a URL from the URLName.
- Throws:
MalformedURLException
public boolean
equals(Object obj)
比较两个 URLName。当且仅当参数不为 null,并且是一个与此对象表示相同 URLName 的 URLName 对象时,结果才为 true。如果两个 URLName 对象拥有相同协议、相同主机、相同主机端口号、相同用户名,并在主机上拥有相同的文件,则两个对象是相等的。如果两个 URLName 对象均为 null,则字段(主机、用户名和文件)也被认为是相同的。
如果名称是相等的(不区分大小写),或者用主机名查找它们都获得成功,并且它们都引用相同的 IP 地址,则主机被认为是相等的。
注意,URLName 没有特定协议的默认端口号的信息,因此 "imap://host" 和 "imap://host:143" 比较起来可能是不相等的。
还要注意的是,比较中不包括密码字段,也不包括追加到文件名中的任何引用字段。
equals
public boolean equals(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 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.
public int
hashCode()
计算此 URLName 的哈希码。
英文文档:
hashCode
public int hashCode()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Submit a bug or feature
Copyright 2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.
PS : 未经我党受权你也可自由散发此文档。 如有任何错误请自行修正;若因此而造成任何损失请直接找人民主席,请勿与本人联系。谢谢!