Methods Summary |
---|
public boolean | equals(java.lang.Object a)The equality operator.
if (!(a instanceof NewsAddress))
return false;
NewsAddress s = (NewsAddress)a;
return newsgroup.equals(s.newsgroup) &&
((host == null && s.host == null) ||
(host != null && s.host != null && host.equalsIgnoreCase(s.host)));
|
public java.lang.String | getHost()Get the host.
return host;
|
public java.lang.String | getNewsgroup()Get the newsgroup.
return newsgroup;
|
public java.lang.String | getType()Return the type of this address. The type of a NewsAddress
is "news".
return "news";
|
public int | hashCode()Compute a hash code for the address.
int hash = 0;
if (newsgroup != null)
hash += newsgroup.hashCode();
if (host != null)
hash += host.toLowerCase(Locale.ENGLISH).hashCode();
return hash;
|
public static javax.mail.internet.NewsAddress[] | parse(java.lang.String newsgroups)Parse the given comma separated sequence of newsgroup into
NewsAddress objects.
// XXX - verify format of newsgroup name?
StringTokenizer st = new StringTokenizer(newsgroups, ",");
Vector nglist = new Vector();
while (st.hasMoreTokens()) {
String ng = st.nextToken();
nglist.addElement(new NewsAddress(ng));
}
int size = nglist.size();
NewsAddress[] na = new NewsAddress[size];
if (size > 0)
nglist.copyInto(na);
return na;
|
public void | setHost(java.lang.String host)Set the host.
this.host = host;
|
public void | setNewsgroup(java.lang.String newsgroup)Set the newsgroup.
this.newsgroup = newsgroup;
|
public static java.lang.String | toString(javax.mail.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.
if (addresses == null || addresses.length == 0)
return null;
StringBuffer s =
new StringBuffer(((NewsAddress)addresses[0]).toString());
for (int i = 1; i < addresses.length; i++)
s.append(",").append(((NewsAddress)addresses[i]).toString());
return s.toString();
|
public java.lang.String | toString()Convert this address into a RFC 1036 address.
return newsgroup;
|