Package javax.mail.internet
Class NewsAddress
- java.lang.Object
-
- javax.mail.Address
-
- javax.mail.internet.NewsAddress
-
- All Implemented Interfaces:
java.io.Serializable
public class NewsAddress extends Address
An RFC 1036 newsgroup address.- Version:
- 1.4
- Author:
- Chris Burdess
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description NewsAddress()Constructor for an empty news address.NewsAddress(java.lang.String newsgroup)Constructor with the given newsgroup.NewsAddress(java.lang.String newsgroup, java.lang.String host)Constructor with the given newsgroup and host.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object a)java.lang.StringgetHost()Returns the hostname of the news server.java.lang.StringgetNewsgroup()Returns the newsgroup.java.lang.StringgetType()Returns the type of this address.inthashCode()static NewsAddress[]parse(java.lang.String newsgroups)Parses the given comma-separated sequence of newsgroups into NewsAddresses.voidsetHost(java.lang.String host)Sets the hostname of the news server.voidsetNewsgroup(java.lang.String newsgroup)Sets the newsgroup.java.lang.StringtoString()Returns an RFC 1036 string representation of this address.static java.lang.StringtoString(Address[] addresses)Converts the given array of NewsAddresses into a comma-separated sequence of address strings.
-
-
-
Constructor Detail
-
NewsAddress
public NewsAddress()
Constructor for an empty news address.
-
NewsAddress
public NewsAddress(java.lang.String newsgroup)
Constructor with the given newsgroup.- Parameters:
newsgroup- the newsgroup
-
NewsAddress
public NewsAddress(java.lang.String newsgroup, java.lang.String host)Constructor with the given newsgroup and host.- Parameters:
newsgroup- the newsgrouphost- the host
-
-
Method Detail
-
getType
public java.lang.String getType()
Returns the type of this address. The type of aNewsAddressis "news".
-
setNewsgroup
public void setNewsgroup(java.lang.String newsgroup)
Sets the newsgroup.- Parameters:
newsgroup- the newsgroup
-
getNewsgroup
public java.lang.String getNewsgroup()
Returns the newsgroup.
-
setHost
public void setHost(java.lang.String host)
Sets the hostname of the news server.- Parameters:
host- the host name
-
getHost
public java.lang.String getHost()
Returns the hostname of the news server.
-
toString
public java.lang.String toString()
Returns an RFC 1036 string representation of this address.
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public static java.lang.String toString(Address[] addresses)
Converts the given array of NewsAddresses into a comma-separated sequence of address strings. The resulting string contains only US-ASCII characters, and is therefore mail-safe.- Parameters:
addresses- the NewsAddress objects- Throws:
java.lang.ClassCastException- if any of the specified addresses is not a NewsAddress
-
parse
public static NewsAddress[] parse(java.lang.String newsgroups) throws AddressException
Parses the given comma-separated sequence of newsgroups into NewsAddresses.- Parameters:
newsgroups- a comma-separated newsgroup string- Throws:
AddressException- if the parse failed
-
-