javax.mail.internet
类 NewsAddress

java.lang.Object
  继承者 javax.mail.Address
      继承者 javax.mail.internet.NewsAddress
所有已实现的接口:
Serializable

public class NewsAddress
extends Address

This class models an RFC1036 newsgroup address.

作者:
Bill Shannon, John Mani
另请参见:
序列化表格

字段摘要
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".

指定者:
Address 中的 getType
返回:
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.

指定者:
Address 中的 toString
返回:
newsgroup

equals

public boolean equals(Object a)
The equality operator.

指定者:
Address 中的 equals
参数:
a - Address object

hashCode

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

覆盖:
Object 中的 hashCode

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


Copyright © 2013. All Rights Reserved.