Package javax.mail.internet
Class NewsAddress
java.lang.Object
javax.mail.Address
javax.mail.internet.NewsAddress
- All Implemented Interfaces:
Serializable
This class models an RFC1036 newsgroup address.
- See Also:
-
Field Summary
-
Constructor Summary
ConstructorDescriptionDefault 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. -
Method Summary
Modifier and TypeMethodDescriptionboolean
The equality operator.getHost()
Get the host.Get the newsgroup.getType()
Return the type of this address.int
hashCode()
Compute a hash code for the address.static NewsAddress[]
Parse the given comma separated sequence of newsgroups into NewsAddress objects.void
Set the host.void
setNewsgroup
(String newsgroup) Set the newsgroup.toString()
Convert this address into a RFC 1036 address.static String
Convert the given array of NewsAddress objects into a comma separated sequence of address strings.
-
Field Details
-
newsgroup
-
host
-
-
Constructor Details
-
NewsAddress
public NewsAddress()Default constructor. -
NewsAddress
Construct a NewsAddress with the given newsgroup.- Parameters:
newsgroup
- the newsgroup
-
NewsAddress
Construct a NewsAddress with the given newsgroup and host.- Parameters:
newsgroup
- the newsgrouphost
- the host
-
-
Method Details
-
getType
Return the type of this address. The type of a NewsAddress is "news". -
setNewsgroup
Set the newsgroup.- Parameters:
newsgroup
- the newsgroup
-
getNewsgroup
Get the newsgroup.- Returns:
- newsgroup
-
setHost
Set the host.- Parameters:
host
- the host
-
getHost
Get the host.- Returns:
- host
-
toString
Convert this address into a RFC 1036 address. -
equals
The equality operator. -
hashCode
public int hashCode()Compute a hash code for the address. -
toString
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:
ClassCastException
- if any address object in the given array is not a NewsAddress objects. Note that this is a RuntimeException.
-
parse
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
-