javax.mail.internet

Class NewsAddress

public class NewsAddress extends Address

An RFC 1036 newsgroup address.

Version: 1.3

Author: Chris Burdess

Field Summary
protected Stringhost
The hostname of the news server.
protected Stringnewsgroup
The name of the newsgroup.
Constructor Summary
NewsAddress()
Constructor for an empty news address.
NewsAddress(String newsgroup)
Constructor with the given newsgroup.
NewsAddress(String newsgroup, String host)
Constructor with the given newsgroup and host.
Method Summary
booleanequals(Object a)
StringgetHost()
Returns the hostname of the news server.
StringgetNewsgroup()
Returns the newsgroup.
StringgetType()
Returns the type of this address.
inthashCode()
static NewsAddress[]parse(String newsgroups)
Parses the given comma-separated sequence of newsgroups into NewsAddresses.
voidsetHost(String host)
Sets the hostname of the news server.
voidsetNewsgroup(String newsgroup)
Sets the newsgroup.
StringtoString()
Returns an RFC 1036 string representation of this address.
static StringtoString(Address[] addresses)
Converts the given array of NewsAddresses into a comma-separated sequence of address strings.

Field Detail

host

protected String host
The hostname of the news server.

newsgroup

protected String newsgroup
The name of the newsgroup.

Constructor Detail

NewsAddress

public NewsAddress()
Constructor for an empty news address.

NewsAddress

public NewsAddress(String newsgroup)
Constructor with the given newsgroup.

Parameters: newsgroup the newsgroup

NewsAddress

public NewsAddress(String newsgroup, String host)
Constructor with the given newsgroup and host.

Parameters: newsgroup the newsgroup host the host

Method Detail

equals

public boolean equals(Object a)

getHost

public String getHost()
Returns the hostname of the news server.

getNewsgroup

public String getNewsgroup()
Returns the newsgroup.

getType

public String getType()
Returns the type of this address. The type of a NewsAddress is "news".

hashCode

public int hashCode()

parse

public static NewsAddress[] parse(String newsgroups)
Parses the given comma-separated sequence of newsgroups into NewsAddresses.

Parameters: newsgroups a comma-separated newsgroup string

Throws: AddressException if the parse failed

setHost

public void setHost(String host)
Sets the hostname of the news server.

Parameters: host the host name

setNewsgroup

public void setNewsgroup(String newsgroup)
Sets the newsgroup.

Parameters: newsgroup the newsgroup

toString

public String toString()
Returns an RFC 1036 string representation of this address.

toString

public static 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: ClassCastException if any of the specified addresses is not a NewsAddress

© Copyright 2003, 2004 The Free Software Foundation, All rights reserved