javax.mail.internet

Class NewsAddress

Implemented Interfaces:
Serializable

public class NewsAddress
extends Address

An RFC 1036 newsgroup address.
Version:
1.4
Author:
Chris Burdess

Field Summary

protected String
host
The hostname of the news server.
protected String
newsgroup
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

boolean
equals(Object a)
String
getHost()
Returns the hostname of the news server.
String
getNewsgroup()
Returns the newsgroup.
String
getType()
Returns the type of this address.
int
hashCode()
static NewsAddress[]
parse(String newsgroups)
Parses the given comma-separated sequence of newsgroups into NewsAddresses.
void
setHost(String host)
Sets the hostname of the news server.
void
setNewsgroup(String newsgroup)
Sets the newsgroup.
String
toString()
Returns an RFC 1036 string representation of this address.
static String
toString(Address[] addresses)
Converts the given array of NewsAddresses into a comma-separated sequence of address strings.

Methods inherited from class javax.mail.Address

equals, getType, toString

Field Details

host

protected String host
The hostname of the news server.

newsgroup

protected String newsgroup
The name of the newsgroup.

Constructor Details

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 Details

equals

public boolean equals(Object a)
Overrides:
equals in interface Address

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".
Overrides:
getType in interface Address

hashCode

public int hashCode()

parse

public static NewsAddress[] parse(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

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.
Overrides:
toString in interface 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

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