- java.lang.Object
- 
- jakarta.mail.Address
- 
- jakarta.mail.internet.NewsAddress
 
 
- 
- All Implemented Interfaces:
- java.io.Serializable
 
 public class NewsAddress extends Address This class models an RFC1036 newsgroup address.- Author:
- Bill Shannon, John Mani
- See Also:
- Serialized Form
 
- 
- 
Constructor SummaryConstructors Constructor Description NewsAddress()Default constructor.NewsAddress(java.lang.String newsgroup)Construct a NewsAddress with the given newsgroup.NewsAddress(java.lang.String newsgroup, java.lang.String host)Construct a NewsAddress with the given newsgroup and host.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object a)The equality operator.java.lang.StringgetHost()Get the host.java.lang.StringgetNewsgroup()Get the newsgroup.java.lang.StringgetType()Return the type of this address.inthashCode()Compute a hash code for the address.static NewsAddress[]parse(java.lang.String newsgroups)Parse the given comma separated sequence of newsgroups into NewsAddress objects.voidsetHost(java.lang.String host)Set the host.voidsetNewsgroup(java.lang.String newsgroup)Set the newsgroup.java.lang.StringtoString()Convert this address into a RFC 1036 address.static java.lang.StringtoString(Address[] addresses)Convert the given array of NewsAddress objects into a comma separated sequence of address strings.
 
- 
- 
- 
Constructor Detail- 
NewsAddresspublic NewsAddress() Default constructor.
 - 
NewsAddresspublic NewsAddress(java.lang.String newsgroup) Construct a NewsAddress with the given newsgroup.- Parameters:
- newsgroup- the newsgroup
 
 - 
NewsAddresspublic NewsAddress(java.lang.String newsgroup, java.lang.String host)Construct a NewsAddress with the given newsgroup and host.- Parameters:
- newsgroup- the newsgroup
- host- the host
 
 
- 
 - 
Method Detail- 
getTypepublic java.lang.String getType() Return the type of this address. The type of a NewsAddress is "news".- Specified by:
- getTypein class- Address
- Returns:
- address type
- See Also:
- InternetAddress
 
 - 
setNewsgrouppublic void setNewsgroup(java.lang.String newsgroup) Set the newsgroup.- Parameters:
- newsgroup- the newsgroup
 
 - 
getNewsgrouppublic java.lang.String getNewsgroup() Get the newsgroup.- Returns:
- newsgroup
 
 - 
setHostpublic void setHost(java.lang.String host) Set the host.- Parameters:
- host- the host
 
 - 
getHostpublic java.lang.String getHost() Get the host.- Returns:
- host
 
 - 
toStringpublic java.lang.String toString() Convert this address into a RFC 1036 address.
 - 
equalspublic boolean equals(java.lang.Object a) The equality operator.
 - 
hashCodepublic int hashCode() Compute a hash code for the address.- Overrides:
- hashCodein class- java.lang.Object
 
 - 
toStringpublic static java.lang.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.- Parameters:
- addresses- array of NewsAddress objects
- Returns:
- comma separated address strings
- Throws:
- java.lang.ClassCastException- if any address object in the given array is not a NewsAddress objects. Note that this is a RuntimeException.
 
 - 
parsepublic static NewsAddress[] parse(java.lang.String newsgroups) throws AddressException Parse the given comma separated sequence of newsgroups into NewsAddress objects.- Parameters:
- newsgroups- comma separated newsgroup string
- Returns:
- array of NewsAddress objects
- Throws:
- AddressException- if the parse failed
 
 
- 
 
-