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.
 


Constructor Index

 o NNTPClient()
Empty default constructor.
 o NNTPClient(String)
Constructs a NNTP session.
 o NNTPClient(String, int)
Constructs a NNTP session.

Method Index

 o articlePosted()
Terminate posting an article.
 o listNewArticles(String, String, String)
Retrieve list of new articles in a newsgroup since a date and time.
 o listNewNewsgroups(String, String)
Retrieve list of new newsgroups since a date and time.
 o listNewsgroups()
Retrieve a list of newsgroups.
 o logoff()
Logoff news server.
 o logon()
Logon to news server.
 o nextArticle()
Point to next article.
 o postArticle()
Post an article by writing to the returned PrintWriter.
 o previousArticle()
Point to previous article.
 o retrieveArticle()
Retrieve a reader with which the current news article can be read.
 o retrieveArticle(String)
Retrieve a reader with which a news article can be read.
 o retrieveArticleBody()
Retrieve a reader with which the current news article body can be read.
 o retrieveArticleBody(String)
Retrieve a reader with which the specified news article body can be read.
 o retrieveArticleHeader()
Retrieve a reader with which the current news article header can be read.
 o retrieveArticleHeader(String)
Retrieve a reader with which a news article header can be read.
 o selectGroup(String)
Select a newsgroup to make current.

Constructors

 o NNTPClient
 public NNTPClient()
Empty default constructor.

 o 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
 o 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

Methods

 o logon
 public void logon() throws IOException
Logon to news server.

Throws: IOException
Could not logon
 o logoff
 public void logoff() throws IOException
Logoff news server.

Throws: IOException
Could not logoff
 o 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;
 o 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;
 o 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;
 o 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;
 o 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;
 o 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;
 o 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
 o 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;
 o 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
 o 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
 o 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
 o 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
 o nextArticle
 public void nextArticle() throws IOException
Point to next article.

Throws: IOException
Failed
 o previousArticle
 public void previousArticle() throws IOException
Point to previous article.

Throws: IOException
Failed

All Packages  Class Hierarchy  This Package  Previous  Next  Index