Enterprise Information Portal APIs

com.ibm.gcs.netutil.nntp
Class NntpClient

java.lang.Object
  |
  +--com.ibm.gcs.netutil.NetworkClient
        |
        +--com.ibm.gcs.netutil.nntp.NntpClient
All Implemented Interfaces:
java.io.Serializable

public class NntpClient
extends NetworkClient
implements java.io.Serializable

This class implements a simple NNTP client. It is used to crawl usenet newsgroups.

See Also:
NetworkClient, Serialized Form

Constructor Summary
NntpClient(java.lang.String hostName, boolean connect)
          Create a new NntpClient.
NntpClient(java.lang.String hostName, int port, boolean connect)
          Create a new NntpClient.
 
Method Summary
static void foo(java.lang.String[] args)
          Some testcode.
 ArticleInfo getArticle(int articleNumber)
          Return the article with the specified number.
 GroupInfo getCurrentGroup()
          get the current group's info
 GroupListInfo listGroups()
          list all groups
 GroupInfo setCurrentGroup(java.lang.String groupName)
          Switch to a specific group.
 
Methods inherited from class com.ibm.gcs.netutil.NetworkClient
connect, disconnect, getHost, getPort, isConnected
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NntpClient

public NntpClient(java.lang.String hostName,
                  int port,
                  boolean connect)
           throws java.net.UnknownHostException,
                  java.io.IOException
Create a new NntpClient.
Parameters:
hostName - - the hostname
port - - the port
Throws:
java.net.UnknownHostException - - Socket could not be opened with specified host
java.io.IOException - - DataOutputStream and/or BufferedReader could not be created

NntpClient

public NntpClient(java.lang.String hostName,
                  boolean connect)
           throws java.net.UnknownHostException,
                  java.io.IOException
Create a new NntpClient.
Parameters:
hostName - - the hostname
Throws:
java.net.UnknownHostException - - Socket could not be opened with specified host
java.io.IOException - - DataOutputStream and/or BufferedReader could not be created
Method Detail

setCurrentGroup

public GroupInfo setCurrentGroup(java.lang.String groupName)
                          throws java.io.IOException
Switch to a specific group.
Parameters:
groupName - - the groupname
Throws:
java.io.IOException - - command could not be sent to the server

getCurrentGroup

public GroupInfo getCurrentGroup()
                          throws java.io.IOException
get the current group's info
Throws:
java.io.IOException - - command could not be sent to the server

listGroups

public GroupListInfo listGroups()
                         throws java.io.IOException
list all groups
Parameters:
groupName - - the groupname
Throws:
java.io.IOException - - command could not be sent to the server

getArticle

public ArticleInfo getArticle(int articleNumber)
                       throws java.io.IOException
Return the article with the specified number.
Parameters:
articleNumber - - the article number
Returns:
String - the article
Throws:
java.io.IOException - - command could not be sent to the server

foo

public static void foo(java.lang.String[] args)
Some testcode.
Parameters:
args - - command line arguments

EIP Web Crawler APIs

(c) Copyright International Business Machines Corporation 1996, 2002. IBM Corp. All rights reserved.