All Packages Class Hierarchy This Package Previous Next Index
Class COM.ibm.net.NNTPClient
java.lang.Object
|
+----COM.ibm.net.InetProtocolClient
|
+----COM.ibm.net.NNTPClient
- public class NNTPClient
- extends InetProtocolClient
Implements a Network News Transfer Protocol (RFC 977) client.
When posting, refer to RFC 850 for article header formats.
Internally supported NNTP commands:
ARTICLE BODY GROUP HEAD LAST LIST NEWGROUPS NEWNEWS NEXT POST QUIT STAT
Unsupported commands:
HELP IHAVE SLAVE
Copyright (c) Taligent, Inc. 1996 - 1997.
Copyright (c) IBM Corporation 1996 - 1997.
All Rights Reserved.
-
NNTPClient()
- Empty default constructor.
-
NNTPClient(String)
- Constructs a NNTP session.
-
NNTPClient(String, int)
- Constructs a NNTP session.
-
articlePosted()
- Terminate posting an article.
-
listNewArticles(String, String, String)
- Retrieve list of new articles in a newsgroup since a
date and time.
-
listNewNewsgroups(String, String)
- Retrieve list of new newsgroups since a date and time.
-
listNewsgroups()
- Retrieve a list of newsgroups.
-
logoff()
- Logoff news server.
-
logon()
- Logon to news server.
-
nextArticle()
- Point to next article.
-
postArticle()
- Post an article by writing to the returned PrintWriter.
-
previousArticle()
- Point to previous article.
-
retrieveArticle()
- Retrieve a reader with which the current news article can
be read.
-
retrieveArticle(String)
- Retrieve a reader with which a news article can
be read.
-
retrieveArticleBody()
- Retrieve a reader with which the current news article body
can be read.
-
retrieveArticleBody(String)
- Retrieve a reader with which the specified news article body
can be read.
-
retrieveArticleHeader()
- Retrieve a reader with which the current news article header
can be read.
-
retrieveArticleHeader(String)
- Retrieve a reader with which a news article header
can be read.
-
selectGroup(String)
- Select a newsgroup to make current.
NNTPClient
public NNTPClient()
- Empty default constructor.
NNTPClient
public NNTPClient(String newsServ)
- Constructs a NNTP session. NNTPClient uses port 119 by default.
- Parameters:
- newsServ - Name or IP address of the news server
NNTPClient
public NNTPClient(String newsServ,
int port)
- Constructs a NNTP session.
- Parameters:
- newsServ - Name or IP address of a news server
- port - Port number of news server
logon
public void logon() throws IOException
- Logon to news server.
- Throws: IOException
- Could not logon
logoff
public void logoff() throws IOException
- Logoff news server.
- Throws: IOException
- Could not logoff
retrieveArticle
public BufferedReader retrieveArticle() throws IOException
- Retrieve a reader with which the current news article can
be read. Select a newsgroup prior to invoking this method.
A line containing only a "." indicates the end of article.
Lines that originally began with a single '.' have it doubled;
strip one during retrieval to produce the original article body.
Do not close the stream upon completion.
- Returns:
- A buffered reader for reading the article
- Throws: IOException
- Could not retrieve article
- See Also:
- BufferedReader;
retrieveArticle
public BufferedReader retrieveArticle(String article) throws IOException
- Retrieve a reader with which a news article can
be read. Select a newsgroup prior to invoking this method.
A line containing only a "." indicates end of article.
Lines that originally began with a single '.' have it doubled;
strip one during retrieval to produce the original article body.
Do not close the stream upon completion.
- Parameters:
- article - News article; number or ID
- Returns:
- A buffered reader for reading the article
- Throws: IOException
- Could not retrieve article
- See Also:
- BufferedReader;
retrieveArticleHeader
public BufferedReader retrieveArticleHeader() throws IOException
- Retrieve a reader with which the current news article header
can be read. Select a newsgroup prior to invoking this method.
A line containing only a "." indicates end of article header.
Do not close the stream upon completion.
- Returns:
- A buffered reader for reading the article header
- Throws: IOException
- Could not retrieve article header
- See Also:
- BufferedReader;
retrieveArticleHeader
public BufferedReader retrieveArticleHeader(String article) throws IOException
- Retrieve a reader with which a news article header
can be read. Select a newsgroup prior to invoking this method.
A line containing only a "." indicates end of article header.
Do not close the stream upon completion.
- Parameters:
- article - News article; number or ID
- Returns:
- A buffered reader for reading the article header
- Throws: IOException
- Could not retrieve article header
- See Also:
- BufferedReader;
retrieveArticleBody
public BufferedReader retrieveArticleBody() throws IOException
- Retrieve a reader with which the current news article body
can be read. Select a newsgroup prior to invoking this method.
A line containing only a "." indicates end of article body.
Lines that originally began with a single '.' have it doubled;
strip one during retrieval to produce the original article body.
Do not close the stream upon completion.
- Returns:
- A buffered reader for reading the article body
- Throws: IOException
- Could not retrieve article body
- See Also:
- BufferedReader;
retrieveArticleBody
public BufferedReader retrieveArticleBody(String article) throws IOException
- Retrieve a reader with which the specified news article body
can be read. Select a newsgroup prior to invoking this method.
The article may be specified by number or ID.
A line containing only a "." indicates end of article body.
Lines that originally began with a single '.' have it doubled;
strip one during retrieval to produce the original article body.
Do not close the stream upon completion.
- Parameters:
- article - News article; number or ID
- Returns:
- A buffered reader for reading the article body
- Throws: IOException
- Could not retrieve article body
- See Also:
- BufferedReader;
selectGroup
public String selectGroup(String group) throws IOException
- Select a newsgroup to make current.
- Parameters:
- group - Newsgroup to make current
- Returns:
- A string containing three tokens separated by a space:
the group's first article number, last article number,
and an estimate of the number of articles in the group.
- Throws: IOException
- Could not select a newsgroup
postArticle
public PrintWriter postArticle() throws IOException
- Post an article by writing to the returned PrintWriter.
If a line begins with a '.', double it for transmission.
Select a newsgroup prior to invoking this method.
You must call articledPosted() to terminate the post.
- Returns:
- A PrintWriter
- Throws: IOException
- Could not initiate article post
- See Also:
- articlePosted, PrintWriter;
articlePosted
public void articlePosted() throws IOException
- Terminate posting an article. Must be called after posting
an article with postArticle().
- Throws: IOException
- Could not terminate article post
- See Also:
- postArticle
listNewsgroups
public String[] listNewsgroups() throws IOException
- Retrieve a list of newsgroups.
- Returns:
- Each returned string contains
four tokens separated by a single space: newsgroup name,
last message number, first message number, 'y' or 'n' indicating
whether posting to newsgroup is allowed.
- Throws: IOException
- Could not retrieve newsgroup list
listNewNewsgroups
public String[] listNewNewsgroups(String date,
String time) throws IOException
- Retrieve list of new newsgroups since a date and time.
- Parameters:
- date - Date "YYMMDD"
- time - Time "HHMMSS"
- Returns:
- Each returned string contains
four tokens separated by a single space: newsgroup name,
last message number, first message number, 'y' or 'n' indicating
whether posting to newsgroup is allowed.
- Throws: IOException
- Could not retrieve newsgroup list
listNewArticles
public String[] listNewArticles(String group,
String date,
String time) throws IOException
- Retrieve list of new articles in a newsgroup since a
date and time.
- Parameters:
- group - Newsgroup
- date - Date "YYMMDD"
- time - Time "HHMMSS"
- Returns:
- Each string returned is a message id
- Throws: IOException
- Could not retrieve article list
nextArticle
public void nextArticle() throws IOException
- Point to next article.
- Throws: IOException
- Failed
previousArticle
public void previousArticle() throws IOException
- Point to previous article.
- Throws: IOException
- Failed
All Packages Class Hierarchy This Package Previous Next Index