| java.lang.Object org.apache.commons.net.nntp.NewGroupsOrNewsQuery
NewGroupsOrNewsQuery | final public class NewGroupsOrNewsQuery (Code) | | The NewGroupsOrNewsQuery class. This is used to issue NNTP NEWGROUPS and
NEWNEWS queries, implemented by
org.apache.commons.net.nntp.NNTPClient.listNewNewsgroups listNewNewsGroups and
org.apache.commons.net.nntp.NNTPClient.listNewNews listNewNews respectively. It prevents you from having to format
date, time, distribution, and newgroup arguments.
You might use the class as follows:
query = new NewsGroupsOrNewsQuery(new GregorianCalendar(97, 11, 15), false);
query.addDistribution("comp");
NewsgroupInfo[] newsgroups = client.listNewgroups(query);
This will retrieve the list of newsgroups starting with the comp.
distribution prefix created since midnight 11/15/97.
author: Daniel F. Savarese See Also: NNTPClient |
Method Summary | |
public void | addDistribution(String distribution) Add a distribution group to the query. | public void | addNewsgroup(String newsgroup) Add a newsgroup to the list of newsgroups being queried. | public String | getDate() Return the NNTP query formatted date (year, month, day in the form
YYMMDD. | public String | getDistributions() Return the comma separated list of distributions. | public String | getNewsgroups() Return the comma separated list of newsgroups. | public String | getTime() Return the NNTP query formatted time (hour, minutes, seconds in the form
HHMMSS. | public boolean | isGMT() Return whether or not the query date should be treated as GMT. | public void | omitNewsgroup(String newsgroup) Add a newsgroup to the list of newsgroups being queried, but indicate
that group should not be checked for new news. |
NewGroupsOrNewsQuery | public NewGroupsOrNewsQuery(Calendar date, boolean gmt)(Code) | | Creates a new query using the given time as a reference point.
Parameters: date - The date since which new groups or news have arrived. Parameters: gmt - True if the date should be considered as GMT, false if not. |
addDistribution | public void addDistribution(String distribution)(Code) | | Add a distribution group to the query. The distribution part of a
newsgroup is the segment of the name preceding the first dot (e.g.,
comp, alt, rec). Only those newsgroups matching one of the
distributions or, in the case of NEWNEWS, an article in a newsgroup
matching one of the distributions, will be reported as a query result.
Adding distributions is purely optional.
Parameters: distribution - A distribution to add to the query. |
addNewsgroup | public void addNewsgroup(String newsgroup)(Code) | | Add a newsgroup to the list of newsgroups being queried. Newsgroups
added this way are only meaningful to the NEWNEWS command. Newsgroup
names may include the * wildcard, as in
comp.lang.* or comp.lang.java.* . Adding
at least one newsgroup is mandatory for the NEWNEWS command.
Parameters: newsgroup - The newsgroup to add to the list of groups to bechecked for new news. |
getDate | public String getDate()(Code) | | Return the NNTP query formatted date (year, month, day in the form
YYMMDD.
The NNTP query formatted date. |
getDistributions | public String getDistributions()(Code) | | Return the comma separated list of distributions. This may be null
if there are no distributions.
The list of distributions, which may be null if no distributionshave been specified. |
getNewsgroups | public String getNewsgroups()(Code) | | Return the comma separated list of newsgroups. This may be null
if there are no newsgroups
The list of newsgroups, which may be null if no newsgroupshave been specified. |
getTime | public String getTime()(Code) | | Return the NNTP query formatted time (hour, minutes, seconds in the form
HHMMSS.
The NNTP query formatted time. |
isGMT | public boolean isGMT()(Code) | | Return whether or not the query date should be treated as GMT.
True if the query date is to be treated as GMT, false if not. |
omitNewsgroup | public void omitNewsgroup(String newsgroup)(Code) | | Add a newsgroup to the list of newsgroups being queried, but indicate
that group should not be checked for new news. Newsgroups
added this way are only meaningful to the NEWNEWS command.
Newsgroup names may include the * wildcard, as in
comp.lang.* or comp.lang.java.* .
The following would create a query that searched for new news in
all comp.lang.java newsgroups except for comp.lang.java.advocacy.
query.addNewsgroup("comp.lang.java.*");
query.omitNewsgroup("comp.lang.java.advocacy");
Parameters: newsgroup - The newsgroup to add to the list of groups to bechecked for new news, but which should be omitted fromthe search for new news.. |
|
|