NewsAddress (Java EE 5 SDK)

Java

Java EE 5 SDK

深圳电信培训中心.徐海蛟老师.


javax.mail.internet Class NewsAddress

java.lang.Object
  extended by javax.mail.Address
      extended by javax.mail.internet.NewsAddress
所有已实现的接口:
Serializable

public class NewsAddress
extends Address

This class models an RFC1036 newsgroup address.

作者:
Bill Shannon, John Mani
另请参见:
Serialized Form

字段摘要
protected  String host
           
protected  String newsgroup
           
 
构造器摘要
NewsAddress()
          Default constructor.
NewsAddress(String newsgroup)
          Construct a NewsAddress with the given newsgroup.
NewsAddress(String newsgroup, String host)
          Construct a NewsAddress with the given newsgroup and host.
 
方法摘要
 boolean equals(Object a)
          The equality operator.
 String getHost()
          Get the host.
 String getNewsgroup()
          Get the newsgroup.
 String getType()
          Return the type of this address.
 int hashCode()
          Compute a hash code for the address.
static NewsAddress[] parse(String newsgroups)
          Parse the given comma separated sequence of newsgroup into NewsAddress objects.
 void setHost(String host)
          Set the host.
 void setNewsgroup(String newsgroup)
          Set the newsgroup.
 String toString()
          Convert this address into a RFC 1036 address.
static String toString(Address[] addresses)
          Convert the given array of NewsAddress objects into a comma separated sequence of address strings.
 
类方法继承 java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

字段详细信息

newsgroup

protected String newsgroup

host

protected String host
构造器详细信息

NewsAddress

public NewsAddress()
Default constructor.


NewsAddress

public NewsAddress(String newsgroup)
Construct a NewsAddress with the given newsgroup.

参数:
newsgroup - the newsgroup


NewsAddress

public NewsAddress(String newsgroup,
                   String host)
Construct a NewsAddress with the given newsgroup and host.

参数:
newsgroup - the newsgroup
host - the host

方法详细信息

getType

public String getType()
Return the type of this address. The type of a NewsAddress is "news".

规范说明:
getType in class Address
返回:
address type
另请参见:
InternetAddress

setNewsgroup

public void setNewsgroup(String newsgroup)
Set the newsgroup.

参数:
newsgroup - the newsgroup

getNewsgroup

public String getNewsgroup()
Get the newsgroup.

返回:
newsgroup

setHost

public void setHost(String host)
Set the host.

参数:
host - the host

getHost

public String getHost()
Get the host.

返回:
host

toString

public String toString()
Convert this address into a RFC 1036 address.

规范说明:
toString in class Address
返回:
newsgroup

equals

public boolean equals(Object a)
The equality operator.

规范说明:
equals in class Address
参数:
a - Address object

hashCode

public int hashCode()
Compute a hash code for the address.

重写:
hashCode in class Object

toString

public static String toString(Address[] addresses)
Convert the given array of NewsAddress objects into a comma separated sequence of address strings. The resulting string contains only US-ASCII characters, and hence is mail-safe.

参数:
addresses - array of NewsAddress objects
返回:
comma separated address strings
抛出异常:
ClassCastException, - if any address object in the given array is not a NewsAddress objects. Note that this is a RuntimeException.

parse

public static NewsAddress[] parse(String newsgroups)
                           throws AddressException
Parse the given comma separated sequence of newsgroup into NewsAddress objects.

参数:
newsgroups - comma separated newsgroup string
返回:
array of NewsAddress objects
抛出异常:
AddressException - if the parse failed

Java EE 5 SDK

深圳电信培训中心.徐海蛟老师.


提交错误或意见

版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。深圳电信培训中心.徐海蛟老师教学参考.