Method from javax.mail.internet.NewsAddress Detail: |
public boolean equals(Object a) {
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 String getHost() {
return host;
}
|
public String getNewsgroup() {
return newsgroup;
}
|
public String getType() {
return "news";
}
Return the type of this address. The type of a NewsAddress
is "news". |
public int hashCode() {
int hash = 0;
if (newsgroup != null)
hash += newsgroup.hashCode();
if (host != null)
hash += host.toLowerCase(Locale.ENGLISH).hashCode();
return hash;
}
Compute a hash code for the address. |
public static NewsAddress[] parse(String newsgroups) throws AddressException {
// 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;
}
Parse the given comma separated sequence of newsgroup into
NewsAddress objects. |
public void setHost(String host) {
this.host = host;
}
|
public void setNewsgroup(String newsgroup) {
this.newsgroup = newsgroup;
}
|
public String toString() {
return newsgroup;
}
Convert this address into a RFC 1036 address. |
public static String toString(Address[] addresses) {
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();
}
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. |