Top Description Fields Constructors Methods
javax.mail.internet

public Class NewsAddress

extends Address
Class Inheritance
Imports
java.util.ArrayList, .List, .StringTokenizer, .Locale, javax.mail.*

This class models an RFC1036 newsgroup address.
Authors
Bill Shannon, John Mani

Field Summary

Modifier and TypeField and Description
protected String
protected String
private static final long

Constructor Summary

AccessConstructor and Description
public
NewsAddress()

Default constructor.

public
NewsAddress(String
the newsgroup
newsgroup
)

Construct a NewsAddress with the given newsgroup.

public
NewsAddress(String
the newsgroup
newsgroup
,
String
the host
host
)

Construct a NewsAddress with the given newsgroup and host.

Method Summary

Modifier and TypeMethod and Description
public boolean
equals(Object
Address object
a
)

Implements abstract javax.mail.Address.equals.

The equality operator.
public String

Returns:

host
getHost
()

Get the host.

public String

Returns:

newsgroup
getNewsgroup
()

Get the newsgroup.

public String
getType()

Implements abstract javax.mail.Address.getType.

Return the type of this address.
public int
hashCode()

Overrides java.lang.Object.hashCode.

Compute a hash code for the address.
public static NewsAddress[]

Returns:

array of NewsAddress objects
parse
(String
comma separated newsgroup string
newsgroups
)

Parse the given comma separated sequence of newsgroups into NewsAddress objects.

public void
setHost(String
the host
host
)

Set the host.

public void
setNewsgroup(String
the newsgroup
newsgroup
)

Set the newsgroup.

public String

Returns:

newsgroup
toString
()

Implements abstract javax.mail.Address.toString.

Convert this address into a RFC 1036 address.
public static String

Returns:

comma separated address strings
toString
(Address[]
array of NewsAddress objects
addresses
)

Convert the given array of NewsAddress objects into a comma separated sequence of address strings.

Field Detail

hostback to summary
protected String host
newsgroupback to summary
protected String newsgroup
serialVersionUIDback to summary
private static final long serialVersionUID

Hides javax.mail.Address.serialVersionUID.

Constructor Detail

NewsAddressback to summary
public NewsAddress()

Default constructor.

NewsAddressback to summary
public NewsAddress(String newsgroup)

Construct a NewsAddress with the given newsgroup.

Parameters
newsgroup:String

the newsgroup

NewsAddressback to summary
public NewsAddress(String newsgroup, String host)

Construct a NewsAddress with the given newsgroup and host.

Parameters
newsgroup:String

the newsgroup

host:String

the host

Method Detail

equalsback to summary
public boolean equals(Object a)

Implements abstract javax.mail.Address.equals.

The equality operator.

Parameters
a:Object

Doc from javax.mail.Address.equals.

Address object

Returns:boolean

Doc from java.lang.Object.equals.

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
getHostback to summary
public String getHost()

Get the host.

Returns:String

host

getNewsgroupback to summary
public String getNewsgroup()

Get the newsgroup.

Returns:String

newsgroup

getTypeback to summary
public String getType()

Implements abstract javax.mail.Address.getType.

Return the type of this address. The type of a NewsAddress is "news".

Returns:String

Doc from javax.mail.Address.getType.

address type

Annotations
@Override
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Compute a hash code for the address.

Returns:int

Doc from java.lang.Object.hashCode.

a hash code value for this object.

Annotations
@Override
parseback to summary
public static NewsAddress[] parse(String newsgroups) throws AddressException

Parse the given comma separated sequence of newsgroups into NewsAddress objects.

Parameters
newsgroups:String

comma separated newsgroup string

Returns:NewsAddress[]

array of NewsAddress objects

Exceptions
AddressException:
if the parse failed
setHostback to summary
public void setHost(String host)

Set the host.

Parameters
host:String

the host

setNewsgroupback to summary
public void setNewsgroup(String newsgroup)

Set the newsgroup.

Parameters
newsgroup:String

the newsgroup

toStringback to summary
public String toString()

Implements abstract javax.mail.Address.toString.

Convert this address into a RFC 1036 address.

Returns:String

newsgroup

Annotations
@Override
toStringback to summary
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.

Parameters
addresses:Address[]

array of NewsAddress objects

Returns:String

comma separated address strings

Exceptions
ClassCastException:
if any address object in the given array is not a NewsAddress objects. Note that this is a RuntimeException.