javax.mail.internet
Class NewsAddress

java.lang.Object
  extended by javax.mail.Address
      extended by javax.mail.internet.NewsAddress
All Implemented Interfaces:
java.io.Serializable

public class NewsAddress
extends Address

An RFC 1036 newsgroup address.

Version:
1.3
Author:
Chris Burdess
See Also:
Serialized Form

Field Summary
protected  java.lang.String host
          The hostname of the news server.
protected  java.lang.String newsgroup
          The name of the newsgroup.
 
Constructor Summary
NewsAddress()
          Constructor for an empty news address.
NewsAddress(java.lang.String newsgroup)
          Constructor with the given newsgroup.
NewsAddress(java.lang.String newsgroup, java.lang.String host)
          Constructor with the given newsgroup and host.
 
Method Summary
 boolean equals(java.lang.Object a)
           
 java.lang.String getHost()
          Returns the hostname of the news server.
 java.lang.String getNewsgroup()
          Returns the newsgroup.
 java.lang.String getType()
          Returns the type of this address.
 int hashCode()
           
static NewsAddress[] parse(java.lang.String newsgroups)
          Parses the given comma-separated sequence of newsgroups into NewsAddresses.
 void setHost(java.lang.String host)
          Sets the hostname of the news server.
 void setNewsgroup(java.lang.String newsgroup)
          Sets the newsgroup.
 java.lang.String toString()
          Returns an RFC 1036 string representation of this address.
static java.lang.String toString(Address[] addresses)
          Converts the given array of NewsAddresses into a comma-separated sequence of address strings.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

newsgroup

protected java.lang.String newsgroup
The name of the newsgroup.


host

protected java.lang.String host
The hostname of the news server.

Constructor Detail

NewsAddress

public NewsAddress()
Constructor for an empty news address.


NewsAddress

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

Parameters:
newsgroup - the newsgroup

NewsAddress

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

Parameters:
newsgroup - the newsgroup
host - the host
Method Detail

getType

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

Specified by:
getType in class Address

setNewsgroup

public void setNewsgroup(java.lang.String newsgroup)
Sets the newsgroup.

Parameters:
newsgroup - the newsgroup

getNewsgroup

public java.lang.String getNewsgroup()
Returns the newsgroup.


setHost

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

Parameters:
host - the host name

getHost

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


toString

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

Specified by:
toString in class Address

equals

public boolean equals(java.lang.Object a)
Specified by:
equals in class Address

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

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

parse

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


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