com.jscape.inet.nntp

## Class Nntp

- java.lang.Object
- - com.jscape.inet.nntp.Nntp

- All Implemented Interfaces:
    java.io.Serializable
  Direct Known Subclasses:
    NntpSsh

      public class Nntp
      extends java.lang.Object
      implements java.io.Serializable

  Implements the basic functionality of a NNTP client.

  Example Usage:

       Nntp nntp = new Nntp();
       nntp.setHostname("news.myserver.com");
       nntp.setUsername("jsmith");
       nntp.setPassword("secret");
        try
       {
         nntp.connect();
         nntp.setNewsgroup("comp.lang.java.programmer");
         // get all headers and print out subject
         Enumeration headers = nntp.getArticleHeaders();
         while(headers.hasMoreElements())
         {
           NntpArticleHeader header = (NntpArticleHeader)headers.nextElement();
           System.out.println(header.getSubject());
         }
         // disconnect
         nntp.disconnect();
       }
       catch(Exception e)
       {
         System.out.println(e);
       }

  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `CMD_ARTICLE` Command to get article.
    `static int` | `CMD_AUTHPASS` Command to send password.
    `static int` | `CMD_AUTHUSER` Command to send username.
    `static int` | `CMD_BODY` Command to get body of article.
    `static int` | `CMD_GROUP` Command to select a newsgroup.
    `static int` | `CMD_HEAD` Command to get header of article.
    `static int` | `CMD_HELP` Command to get NNTP help.
    `static int` | `CMD_LAST` Command to get previous article.
    `static int` | `CMD_LIST` Command to list newsgroups.
    `static int` | `CMD_NEWGROUPS` Command to get new newsgroups.
    `static int` | `CMD_NEWNEWS` Command to get new articles.
    `static int` | `CMD_NEXT` Command to get next article.
    `static int` | `CMD_POST` Command to post article.
    `static int` | `CMD_QUIT` Command to logout.
    `static int` | `CMD_STAT` Command to get information about an article.
    `static int` | `MODE` Command to indicate to NNTP server that this is a NNTP reader.
    `static int` | `RESPONSE_ARTICLE_LIST_BY_MESSAGE_ID_FOLLOWS` Response code article list by message-id follows.
    `static int` | `RESPONSE_ARTICLE_NOT_WANTED` Response code article not wanted.
    `static int` | `RESPONSE_ARTICLE_POSTED_OK` Response code article posted.
    `static int` | `RESPONSE_ARTICLE_REJECTED` Response code article rejected.
    `static int` | `RESPONSE_ARTICLE_RETRIEVED_BODY_FOLLOWS` Response code article retrieved body follows.
    `static int` | `RESPONSE_ARTICLE_RETRIEVED_HEAD_AND_BODY_FOLLOW` Response code article retrieved head and body follows.
    `static int` | `RESPONSE_ARTICLE_RETRIEVED_HEAD_FOLLOWS` Response code article retrieved head follows.
    `static int` | `RESPONSE_ARTICLE_RETRIEVED_REQUEST_TEXT_SEPARATELY` Response code article retrieved request text separately.
    `static int` | `RESPONSE_ARTICLE_TRANSFERRED_OK` Response code article transferred.
    `static int` | `RESPONSE_AUTH_FAILED` Response code authentication failed.
    `static int` | `RESPONSE_AUTH_FAILED_OLD` Response code authentication failed.
    `static int` | `RESPONSE_AUTH_FAILED_OLD2` Response code authentication failed.
    `static int` | `RESPONSE_AUTH_OK` Response code authentication passed.
    `static int` | `RESPONSE_AUTH_OK_OLD` Response code authentication passed.
    `static int` | `RESPONSE_CLOSING_CONNECTION` Response code closing connection.
    `static int` | `RESPONSE_COMMAND_NOT_RECOGNIZED` Response code command not recognized.
    `static int` | `RESPONSE_COMMAND_SYNTAX_ERROR` Response code syntax error.
    `static int` | `RESPONSE_CONTINUE_AUTH` Response code continue authentication.
    `static int` | `RESPONSE_DEBUG` Response for help.
    `static int` | `RESPONSE_GROUP_SELECTED` Response code group selected.
    `static int` | `RESPONSE_HELP` Response for help.
    `static int` | `RESPONSE_NEW_NEWSGROUP_LIST_FOLLOWS` Response code newsgroup list follows.
    `static int` | `RESPONSE_NO_CURRENT_ARTICLE_SELECTED` Response code no current article selected.
    `static int` | `RESPONSE_NO_NEWSGROUP_SELECTED` Response code no newsgroup selected.
    `static int` | `RESPONSE_NO_NEXT_ARTICLE` Response code no next article.
    `static int` | `RESPONSE_NO_PREVIOUS_ARTICLE` Response code no previous article.
    `static int` | `RESPONSE_NO_SUCH_ARTICLE_FOUND` Response code article not found.
    `static int` | `RESPONSE_NO_SUCH_ARTICLE_NUMBER` Response code no such article number.
    `static int` | `RESPONSE_NO_SUCH_NEWSGROUP` Response code no such newsgroup.
    `static int` | `RESPONSE_OK_POSTING_ALLOWED` Response to indicate posting to NNTP server allowed.
    `static int` | `RESPONSE_OK_POSTING_NOT_ALLOWED` Response to indicate posting to NNTP server not allowed.
    `static int` | `RESPONSE_PERMISSION_DENIED` Response code permission denied.
    `static int` | `RESPONSE_POSTING_FAILED` Response code posting failed.
    `static int` | `RESPONSE_POSTING_NOT_ALLOWED` Response code posting not allowed.
    `static int` | `RESPONSE_POSTING_REJECTED` Response code post rejected.
    `static int` | `RESPONSE_POSTING_REJECTED_OLD` Response code post rejected.
    `static int` | `RESPONSE_PROGRAM_FAULT` Response code server error.
    `static int` | `RESPONSE_SEND_ARTICLE_TO_POST` Response code send article to post.
    `static int` | `RESPONSE_SEND_ARTICLE_TO_TRANSFER` Response code send article to transfer.
    `static int` | `RESPONSE_SERVICE_DISCONTINUED` Response code service temporarily unavailable.
    `static int` | `RESPONSE_SLAVE_NOTED` Response to indicate that slave status is noted.
    `static int` | `RESPONSE_TRANSFER_FAILED` Response code transfer failed.
    `static int` | `SCMD_IHAVE` Command to indicate to NNTP server that client has an article.
    `static int` | `SCMD_SLAVE` Command to indicate to NNTP server that this client connection is to a slave server rather than a user.
    `static int` | `XOVER` Command to get a set of articles from NNTP server.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Nntp()` Constructs new `Nntp` instance.
    `Nntp(java.lang.String hostname)` Constructs `Nntp` instance with specified server name.
    `Nntp(java.lang.String hostname, java.lang.String username, java.lang.String password)` Constructs `Nntp` instance with specified server name, port and username / password for authentication.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addNntpListener(NntpListener listener)` Adds Nntp event listener.
    `void` | `clearProxySettings()` Clears proxy server values.
    `void` | `connect()` Connects to NNTP server and authenticates using username and password if found.
    `void` | `disconnect()` Disconnects from NNTP server.
    `NntpArticle` | `getArticle(int articleId)` Gets an article from current newsgroup.
    `NntpArticle` | `getArticle(java.lang.String messageID)` Gets an article from current newsgroup based on its Message-ID header.
    `NntpArticleHeader` | `getArticleHeader(int articleId)` Gets article header from current newsgroup.
    `java.util.Enumeration` | `getArticleHeaders()` Gets all article headers from current newsgroup.
    `java.util.Enumeration` | `getArticleHeaders(java.util.Date date)` Gets all article headers for current active newsgroup since a specified date.
    `java.util.Enumeration` | `getArticleHeaders(int start, int end)` Gets all article headers from NNTP server within a specific range using the XOVER command.
    `java.util.Enumeration` | `getArticleHeaders(java.lang.String group)` Gets all article headers for a newsgroup.
    `java.util.Enumeration` | `getArticleHeaders(java.lang.String[] groups, java.util.Date date)` Gets article headers since a certain date in specified newsgroups.
    `NntpNewsgroup` | `getCurrentNewsgroup()` Gets the currently active newsgroup.
    `boolean` | `getDebug()` Get debugging state.
    `java.io.PrintStream` | `getDebugStream()` Gets PrintStream used in reporting debug statements.
    `java.lang.String` | `getHostname()` Gets hostname of NNTP server.
    `NntpNewsgroup` | `getNewsgroup(java.lang.String group)` Creates `NntpNewsgroup` from server response to GROUP command. Posting permission is not available in response to this command and it will be assigned to true.
    `java.util.Enumeration` | `getNewsgroups()` Gets all newsgroups from NNTP server.
    `java.util.Enumeration` | `getNewsgroups(java.util.Date date)` Gets new newgroups from NNTP server since a specified date.
    `NntpArticle` | `getNextArticle()` Gets next article from current newsgroup.
    `NntpArticleHeader` | `getNextHeader()` Gets next article header from newsgroup.
    `int` | `getPort()` Gets port of NNTP server.
    `NntpArticle` | `getPreviousArticle()` Gets previous article from current newsgroup.
    `NntpArticleHeader` | `getPreviousHeader()` Gets previous article header from current newsgroup.
    `java.lang.String` | `getProxyHost()` Gets the hostname of the proxy server to be used in Nntp communications.
    `int` | `getProxyPort()` Gets the port to be used when communicating with an Nntp proxy server.
    `java.lang.String` | `getResponseString()` Gets reponse from last NNTP command.
    `java.util.Enumeration` | `getResponseStrings()` Gets history of all NNTP responses for this session.
    `int` | `getTimeout()` Gets the timeout used when opening a NNTP server connection.
    `java.lang.String` | `getUsername()` Gets username currently used for authentication.
    `java.lang.String` | `issueCommand(java.lang.String command)` Sends command to NNTP server.
    `void` | `postArticle(NntpArticle article)` Posts an article to NNTP server.
    `void` | `removeNntpListener(NntpListener listener)` Removes specified Nntp event listener.
    `void` | `setDebug(boolean debug)` Set debugging state.
    `void` | `setDebugStream(java.io.PrintStream debugStream)` Sets PrintStream used in reporting debug statements.
    `void` | `setHostname(java.lang.String hostname)` Sets hostname of NNTP server.
    `void` | `setNewsgroup(NntpNewsgroup group)` Sets current active newsgroup.
    `void` | `setNewsgroup(java.lang.String group)` Sets current active newsgroup.
    `void` | `setPassword(java.lang.String password)` Sets password for authentication.
    `void` | `setPort(int port)` Sets port of NNTP server.
    `void` | `setProxyAuthentication(java.lang.String proxyUsername, java.lang.String proxyPassword)` Sets the username and password to use when for authentication with proxy server.
    `void` | `setProxyHost(java.lang.String proxyHost)` Sets the hostname of the proxy server to be used in Nntp communications.
    `void` | `setProxyHost(java.lang.String proxyHostname, int proxyPort)` Sets the proxy hostname and port for this connection.
    `void` | `setProxyPort(int proxyPort)` Sets the port to be used when communicating with an Nntp proxy server.
    `void` | `setProxyType(java.lang.String proxyType)` Sets the proxy type will be used for this connection.
    `void` | `setTimeout(int timeout)` Sets the timeout for opening a NNTP server connection.
    `void` | `setUsername(java.lang.String username)` Sets username for authentication.

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### CMD_AUTHUSER

          public static final int CMD_AUTHUSER

      Command to send username.
      See Also:
        Constant Field Values

    - #### CMD_AUTHPASS

          public static final int CMD_AUTHPASS

      Command to send password.
      See Also:
        Constant Field Values

    - #### CMD_LIST

          public static final int CMD_LIST

      Command to list newsgroups.
      See Also:
        Constant Field Values

    - #### CMD_NEWGROUPS

          public static final int CMD_NEWGROUPS

      Command to get new newsgroups.
      See Also:
        Constant Field Values

    - #### CMD_NEWNEWS

          public static final int CMD_NEWNEWS

      Command to get new articles.
      See Also:
        Constant Field Values

    - #### CMD_GROUP

          public static final int CMD_GROUP

      Command to select a newsgroup.
      See Also:
        Constant Field Values

    - #### CMD_HEAD

          public static final int CMD_HEAD

      Command to get header of article.
      See Also:
        Constant Field Values

    - #### CMD_BODY

          public static final int CMD_BODY

      Command to get body of article.
      See Also:
        Constant Field Values

    - #### CMD_ARTICLE

          public static final int CMD_ARTICLE

      Command to get article.
      See Also:
        Constant Field Values

    - #### CMD_STAT

          public static final int CMD_STAT

      Command to get information about an article.
      See Also:
        Constant Field Values

    - #### CMD_NEXT

          public static final int CMD_NEXT

      Command to get next article.
      See Also:
        Constant Field Values

    - #### CMD_LAST

          public static final int CMD_LAST

      Command to get previous article.
      See Also:
        Constant Field Values

    - #### CMD_POST

          public static final int CMD_POST

      Command to post article.
      See Also:
        Constant Field Values

    - #### CMD_QUIT

          public static final int CMD_QUIT

      Command to logout.
      See Also:
        Constant Field Values

    - #### CMD_HELP

          public static final int CMD_HELP

      Command to get NNTP help.
      See Also:
        Constant Field Values

    - #### SCMD_IHAVE

          public static final int SCMD_IHAVE

      Command to indicate to NNTP server that client has an article.
      See Also:
        Constant Field Values

    - #### SCMD_SLAVE

          public static final int SCMD_SLAVE

      Command to indicate to NNTP server that this client connection is to a slave server rather than a user.
      See Also:
        Constant Field Values

    - #### MODE

          public static final int MODE

      Command to indicate to NNTP server that this is a NNTP reader.
      See Also:
        Constant Field Values

    - #### XOVER

          public static final int XOVER

      Command to get a set of articles from NNTP server.
      See Also:
        Constant Field Values

    - #### RESPONSE_HELP

          public static final int RESPONSE_HELP

      Response for help.
      See Also:
        Constant Field Values

    - #### RESPONSE_DEBUG

          public static final int RESPONSE_DEBUG

      Response for help.
      See Also:
        Constant Field Values

    - #### RESPONSE_OK_POSTING_ALLOWED

          public static final int RESPONSE_OK_POSTING_ALLOWED

      Response to indicate posting to NNTP server allowed.
      See Also:
        Constant Field Values

    - #### RESPONSE_OK_POSTING_NOT_ALLOWED

          public static final int RESPONSE_OK_POSTING_NOT_ALLOWED

      Response to indicate posting to NNTP server not allowed.
      See Also:
        Constant Field Values

    - #### RESPONSE_SLAVE_NOTED

          public static final int RESPONSE_SLAVE_NOTED

      Response to indicate that slave status is noted.
      See Also:
        Constant Field Values

    - #### RESPONSE_CLOSING_CONNECTION

          public static final int RESPONSE_CLOSING_CONNECTION

      Response code closing connection.
      See Also:
        Constant Field Values

    - #### RESPONSE_GROUP_SELECTED

          public static final int RESPONSE_GROUP_SELECTED

      Response code group selected.
      See Also:
        Constant Field Values

    - #### RESPONSE_ARTICLE_RETRIEVED_HEAD_AND_BODY_FOLLOW

          public static final int RESPONSE_ARTICLE_RETRIEVED_HEAD_AND_BODY_FOLLOW

      Response code article retrieved head and body follows.
      See Also:
        Constant Field Values

    - #### RESPONSE_ARTICLE_RETRIEVED_HEAD_FOLLOWS

          public static final int RESPONSE_ARTICLE_RETRIEVED_HEAD_FOLLOWS

      Response code article retrieved head follows.
      See Also:
        Constant Field Values

    - #### RESPONSE_ARTICLE_RETRIEVED_BODY_FOLLOWS

          public static final int RESPONSE_ARTICLE_RETRIEVED_BODY_FOLLOWS

      Response code article retrieved body follows.
      See Also:
        Constant Field Values

    - #### RESPONSE_ARTICLE_RETRIEVED_REQUEST_TEXT_SEPARATELY

          public static final int RESPONSE_ARTICLE_RETRIEVED_REQUEST_TEXT_SEPARATELY

      Response code article retrieved request text separately.
      See Also:
        Constant Field Values

    - #### RESPONSE_ARTICLE_LIST_BY_MESSAGE_ID_FOLLOWS

          public static final int RESPONSE_ARTICLE_LIST_BY_MESSAGE_ID_FOLLOWS

      Response code article list by message-id follows.
      See Also:
        Constant Field Values

    - #### RESPONSE_NEW_NEWSGROUP_LIST_FOLLOWS

          public static final int RESPONSE_NEW_NEWSGROUP_LIST_FOLLOWS

      Response code newsgroup list follows.
      See Also:
        Constant Field Values

    - #### RESPONSE_ARTICLE_TRANSFERRED_OK

          public static final int RESPONSE_ARTICLE_TRANSFERRED_OK

      Response code article transferred.
      See Also:
        Constant Field Values

    - #### RESPONSE_ARTICLE_POSTED_OK

          public static final int RESPONSE_ARTICLE_POSTED_OK

      Response code article posted.
      See Also:
        Constant Field Values

    - #### RESPONSE_AUTH_OK

          public static final int RESPONSE_AUTH_OK

      Response code authentication passed.
      See Also:
        Constant Field Values

    - #### RESPONSE_AUTH_OK_OLD

          public static final int RESPONSE_AUTH_OK_OLD

      Response code authentication passed.
      See Also:
        Constant Field Values

    - #### RESPONSE_SEND_ARTICLE_TO_TRANSFER

          public static final int RESPONSE_SEND_ARTICLE_TO_TRANSFER

      Response code send article to transfer.
      See Also:
        Constant Field Values

    - #### RESPONSE_SEND_ARTICLE_TO_POST

          public static final int RESPONSE_SEND_ARTICLE_TO_POST

      Response code send article to post.
      See Also:
        Constant Field Values

    - #### RESPONSE_CONTINUE_AUTH

          public static final int RESPONSE_CONTINUE_AUTH

      Response code continue authentication.
      See Also:
        Constant Field Values

    - #### RESPONSE_AUTH_FAILED_OLD

          public static final int RESPONSE_AUTH_FAILED_OLD

      Response code authentication failed.
      See Also:
        Constant Field Values

    - #### RESPONSE_SERVICE_DISCONTINUED

          public static final int RESPONSE_SERVICE_DISCONTINUED

      Response code service temporarily unavailable.
      See Also:
        Constant Field Values

    - #### RESPONSE_NO_SUCH_NEWSGROUP

          public static final int RESPONSE_NO_SUCH_NEWSGROUP

      Response code no such newsgroup.
      See Also:
        Constant Field Values

    - #### RESPONSE_NO_NEWSGROUP_SELECTED

          public static final int RESPONSE_NO_NEWSGROUP_SELECTED

      Response code no newsgroup selected.
      See Also:
        Constant Field Values

    - #### RESPONSE_NO_CURRENT_ARTICLE_SELECTED

          public static final int RESPONSE_NO_CURRENT_ARTICLE_SELECTED

      Response code no current article selected.
      See Also:
        Constant Field Values

    - #### RESPONSE_NO_NEXT_ARTICLE

          public static final int RESPONSE_NO_NEXT_ARTICLE

      Response code no next article.
      See Also:
        Constant Field Values

    - #### RESPONSE_NO_PREVIOUS_ARTICLE

          public static final int RESPONSE_NO_PREVIOUS_ARTICLE

      Response code no previous article.
      See Also:
        Constant Field Values

    - #### RESPONSE_NO_SUCH_ARTICLE_NUMBER

          public static final int RESPONSE_NO_SUCH_ARTICLE_NUMBER

      Response code no such article number.
      See Also:
        Constant Field Values

    - #### RESPONSE_NO_SUCH_ARTICLE_FOUND

          public static final int RESPONSE_NO_SUCH_ARTICLE_FOUND

      Response code article not found.
      See Also:
        Constant Field Values

    - #### RESPONSE_ARTICLE_NOT_WANTED

          public static final int RESPONSE_ARTICLE_NOT_WANTED

      Response code article not wanted.
      See Also:
        Constant Field Values

    - #### RESPONSE_TRANSFER_FAILED

          public static final int RESPONSE_TRANSFER_FAILED

      Response code transfer failed.
      See Also:
        Constant Field Values

    - #### RESPONSE_ARTICLE_REJECTED

          public static final int RESPONSE_ARTICLE_REJECTED

      Response code article rejected.
      See Also:
        Constant Field Values

    - #### RESPONSE_POSTING_NOT_ALLOWED

          public static final int RESPONSE_POSTING_NOT_ALLOWED

      Response code posting not allowed.
      See Also:
        Constant Field Values

    - #### RESPONSE_POSTING_FAILED

          public static final int RESPONSE_POSTING_FAILED

      Response code posting failed.
      See Also:
        Constant Field Values

    - #### RESPONSE_AUTH_FAILED

          public static final int RESPONSE_AUTH_FAILED

      Response code authentication failed.
      See Also:
        Constant Field Values

    - #### RESPONSE_POSTING_REJECTED

          public static final int RESPONSE_POSTING_REJECTED

      Response code post rejected.
      See Also:
        Constant Field Values

    - #### RESPONSE_AUTH_FAILED_OLD2

          public static final int RESPONSE_AUTH_FAILED_OLD2

      Response code authentication failed.
      See Also:
        Constant Field Values

    - #### RESPONSE_POSTING_REJECTED_OLD

          public static final int RESPONSE_POSTING_REJECTED_OLD

      Response code post rejected.
      See Also:
        Constant Field Values

    - #### RESPONSE_COMMAND_NOT_RECOGNIZED

          public static final int RESPONSE_COMMAND_NOT_RECOGNIZED

      Response code command not recognized.
      See Also:
        Constant Field Values

    - #### RESPONSE_COMMAND_SYNTAX_ERROR

          public static final int RESPONSE_COMMAND_SYNTAX_ERROR

      Response code syntax error.
      See Also:
        Constant Field Values

    - #### RESPONSE_PERMISSION_DENIED

          public static final int RESPONSE_PERMISSION_DENIED

      Response code permission denied.
      See Also:
        Constant Field Values

    - #### RESPONSE_PROGRAM_FAULT

          public static final int RESPONSE_PROGRAM_FAULT

      Response code server error.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### Nntp

          public Nntp()

      Constructs new `Nntp` instance.

    - #### Nntp

          public Nntp(java.lang.String hostname,
                      java.lang.String username,
                      java.lang.String password)

      Constructs `Nntp` instance with specified server name, port and username / password for authentication.
      Parameters:
        `hostname` - the hostname of NNTP server
        `username` - the username of NNTP user
        `password` - the password of NNTP user

    - #### Nntp

          public Nntp(java.lang.String hostname)

      Constructs `Nntp` instance with specified server name.
      Parameters:
        `hostname` - the hostname of NNTP server

  - ### Method Detail

    - #### getResponseString

          public java.lang.String getResponseString()

      Gets reponse from last NNTP command.
      Returns:
        response

    - #### getResponseStrings

          public java.util.Enumeration getResponseStrings()

      Gets history of all NNTP responses for this session.
      Returns:
        a Enumeration of responses

    - #### connect

          public void connect()
                       throws NntpException

      Connects to NNTP server and authenticates using username and password if found.
      Throws:
        `NntpException` - thrown for I/O or NNTP related errors

    - #### disconnect

          public void disconnect()

      Disconnects from NNTP server.

    - #### setHostname

          public void setHostname(java.lang.String hostname)

      Sets hostname of NNTP server.
      Parameters:
        `hostname` - the hostname of NNTP server

    - #### getHostname

          public java.lang.String getHostname()

      Gets hostname of NNTP server.
      Returns:
        hostname

    - #### setPort

          public void setPort(int port)

      Sets port of NNTP server. Default port value is 119.
      Parameters:
        `port` - the port of NNTP server

    - #### getPort

          public int getPort()

      Gets port of NNTP server. Default port value is 119.
      Returns:
        port

    - #### getNewsgroups

          public java.util.Enumeration getNewsgroups()
                                              throws NntpException

      Gets all newsgroups from NNTP server.
      Returns:
        an Enumeration of `NntpNewsgroup`
      Throws:
        `NntpException` - thrown for I/O or NNTP related errors

    - #### getNewsgroups

          public java.util.Enumeration getNewsgroups(java.util.Date date)
                                              throws NntpException

      Gets new newgroups from NNTP server since a specified date.
      Parameters:
        `date` - the start `Date` used to find new newsgroups
      Returns:
        an Enumeration of `NntpNewsgroup`
      Throws:
        `NntpException` - thrown for I/O or Nntp related errors

    - #### getCurrentNewsgroup

          public NntpNewsgroup getCurrentNewsgroup()

      Gets the currently active newsgroup.
      Returns:
        a `NntpNewsgroup`

    - #### getNewsgroup

          public NntpNewsgroup getNewsgroup(java.lang.String group)
                                     throws NntpException

      Creates `NntpNewsgroup` from server response to GROUP command.
      Posting permission is not available in response to this command and it will be assigned to true. Note that this command will not assign instance current newsgroup.
      Parameters:
        `group` - the newsgroup to retrieve
      Returns:
        a `NntpNewsgroup`
      Throws:
        `NntpException` - thrown for I/O or Nntp related errors

    - #### setNewsgroup

          public void setNewsgroup(NntpNewsgroup group)
                            throws NntpException

      Sets current active newsgroup.
      Parameters:
        `group` - the name of newsgroup
      Throws:
        `NntpException` - thrown for I/O or Nntp related errors

    - #### setNewsgroup

          public void setNewsgroup(java.lang.String group)
                            throws NntpException

      Sets current active newsgroup.
      Parameters:
        `group` - the name of newsgroup
      Throws:
        `NntpException` - thrown for I/O or Nntp related errors

    - #### getNextHeader

          public NntpArticleHeader getNextHeader()
                                          throws NntpException

      Gets next article header from newsgroup.
      Returns:
        a `NntpArticleHeader` or `null` if not available
      Throws:
        `NntpException` - thrown for I/O or Nntp related errors

    - #### getArticleHeaders

          public java.util.Enumeration getArticleHeaders(int start,
                                                         int end)
                                                  throws NntpException

      Gets all article headers from NNTP server within a specific range using the XOVER command.
      Parameters:
        `start` - the start article
        `end` - the end article
      Returns:
        an Enumeration of NntpArticleHeader
      Throws:
        `NntpException` - if an error occurs

    - #### getArticleHeaders

          public java.util.Enumeration getArticleHeaders()
                                                  throws NntpException

      Gets all article headers from current newsgroup.
      Returns:
        an `Enumeration` of `NntpArticleHeader`
      Throws:
        `NntpException` - thrown for I/O or Nntp related errors

    - #### getArticleHeaders

          public java.util.Enumeration getArticleHeaders(java.lang.String group)
                                                  throws NntpException

      Gets all article headers for a newsgroup. This command will set current active newsgroup to value of parameter group.
      Parameters:
        `group` - the name of newsgroup
      Returns:
        an `Enumeration` of `NntpArticleHeader`
      Throws:
        `NntpException` - thrown for I/O or Nntp related errors

    - #### getArticleHeader

          public NntpArticleHeader getArticleHeader(int articleId)
                                             throws NntpException

      Gets article header from current newsgroup.
      Parameters:
        `articleId` - the article id to retrieve
      Returns:
        a `NntpArticleHeader` or `null` if not available
      Throws:
        `NntpException` - thrown for I/O or Nntp related errors

    - #### getArticleHeaders

          public java.util.Enumeration getArticleHeaders(java.util.Date date)
                                                  throws NntpException

      Gets all article headers for current active newsgroup since a specified date. This method will fire a NntpProgressEvent(s) as it is usual that queries like this may take a while. Once server has collected articles that match query, each header is retrieved and `NntpArticleHeaderEvent` is generated for each new header.
      Parameters:
        `date` - the start `Date` used to find new article headers
      Returns:
        an `Enumeration` of `NntpArticleHeader`
      Throws:
        `NntpException` - thrown for I/O or Nntp related errors

    - #### getArticleHeaders

          public java.util.Enumeration getArticleHeaders(java.lang.String[] groups,
                                                         java.util.Date date)
                                                  throws NntpException

      Gets article headers since a certain date in specified newsgroups. This command will not affect current newsgroup field of this Nntp instance.
      Parameters:
        `groups` - the groups to retrieve
        `date` - the start date to retrieve articles
      Returns:
        an `Enumeration` of `NntpArticleHeader`
      Throws:
        `NntpException` - thrown for I/O or Nntp related errors

    - #### getArticle

          public NntpArticle getArticle(int articleId)
                                 throws NntpException

      Gets an article from current newsgroup.
      Parameters:
        `articleId` - the index based id of article
      Returns:
        a `NntpArticle` or null if not available
      Throws:
        `NntpException` - thrown for I/O or Nntp related errors

    - #### getArticle

          public NntpArticle getArticle(java.lang.String messageID)
                                 throws NntpException

      Gets an article from current newsgroup based on its Message-ID header. The messageID parameter can be obtained from 'Message-ID' header in `NntpArticleHeader`.
      Parameters:
        `messageID` - the unique message id for article
      Returns:
        a `NntpArticle` or null if not found
      Throws:
        `NntpException` - thrown for I/O or Nntp related errors

    - #### getNextArticle

          public NntpArticle getNextArticle()
                                     throws NntpException

      Gets next article from current newsgroup.
      Returns:
        a `NntpArticle` or `null` if not found
      Throws:
        `NntpException` - thrown for I/O or Nntp related errors

    - #### getPreviousArticle

          public NntpArticle getPreviousArticle()
                                         throws NntpException

      Gets previous article from current newsgroup.
      Returns:
        a `NntpArticle` or `null` if not found
      Throws:
        `NntpException` - thrown for I/O or Nntp related errors

    - #### getPreviousHeader

          public NntpArticleHeader getPreviousHeader()
                                              throws NntpException

      Gets previous article header from current newsgroup.
      Returns:
        a `NntpArticleHeader` or `null` if not found
      Throws:
        `NntpException` - thrown for I/O or Nntp related errors

    - #### postArticle

          public void postArticle(NntpArticle article)
                           throws NntpException

      Posts an article to NNTP server. If authentication is required and username is supplied, this method will try to authenticate. Password may be sent only if required by server per RFC 2980.
      Parameters:
        `article` - the `NntpArticle` to post
      Throws:
        `NntpException` - thrown for I/O or Nntp related errors

    - #### setUsername

          public void setUsername(java.lang.String username)

      Sets username for authentication.
      Parameters:
        `username` - the username of Nntp user

    - #### getUsername

          public java.lang.String getUsername()

      Gets username currently used for authentication.
      Returns:
        username

    - #### setPassword

          public void setPassword(java.lang.String password)

      Sets password for authentication.
      Parameters:
        `password` - the password of NNTP user

    - #### setProxyHost

          public void setProxyHost(java.lang.String proxyHost)

      Sets the hostname of the proxy server to be used in Nntp communications.
      Parameters:
        `proxyHost` - the hostname or ipaddress of the proxy server

    - #### getProxyHost

          public java.lang.String getProxyHost()

      Gets the hostname of the proxy server to be used in Nntp communications.
      Returns:
        the hostname or ipaddress of the proxy server

    - #### setProxyPort

          public void setProxyPort(int proxyPort)

      Sets the port to be used when communicating with an Nntp proxy server.
      Parameters:
        `proxyPort` - port of listening Nntp proxy server

    - #### getProxyPort

          public int getProxyPort()

      Gets the port to be used when communicating with an Nntp proxy server.
      Returns:
        the port of listening Nntp proxy server

    - #### setProxyAuthentication

          public void setProxyAuthentication(java.lang.String proxyUsername,
                                             java.lang.String proxyPassword)

      Sets the username and password to use when for authentication with proxy server. To clear these settings invoke the `#clearProxySettings` method.
      Parameters:
        `proxyUsername` - the proxy username
        `proxyPassword` - the proxy password
      See Also:
        `clearProxySettings()`

    - #### setProxyHost

          public void setProxyHost(java.lang.String proxyHostname,
                                   int proxyPort)

      Sets the proxy hostname and port for this connection. To clear these settings invoke the `#clearProxySettings` method.
      Parameters:
        `proxyHostname` - the hostname or ip address of the proxy server
        `proxyPort` - the port of the proxy server
      See Also:
        `clearProxySettings()`

    - #### setProxyType

          public void setProxyType(java.lang.String proxyType)

      Sets the proxy type will be used for this connection.
      Parameters:
        `proxyType` - The proxy type. Valid values: HTTP, SOCKS5

    - #### clearProxySettings

          public void clearProxySettings()

      Clears proxy server values.

    - #### addNntpListener

          public void addNntpListener(NntpListener listener)

      Adds Nntp event listener.
      Parameters:
        `listener` - a `NntpListener`
      See Also:
        `NntpListener`

    - #### removeNntpListener

          public void removeNntpListener(NntpListener listener)

      Removes specified Nntp event listener.
      Parameters:
        `listener` - the listener to remove
      See Also:
        `NntpListener`

    - #### setTimeout

          public void setTimeout(int timeout)

      Sets the timeout for opening a NNTP server connection. Default is 30 seconds.
      Parameters:
        `timeout` - in milliseconds

    - #### getTimeout

          public int getTimeout()

      Gets the timeout used when opening a NNTP server connection. Default is 30 seconds.
      Returns:
        timeout in milliseconds

    - #### issueCommand

          public java.lang.String issueCommand(java.lang.String command)
                                        throws NntpException

      Sends command to NNTP server.
      Parameters:
        `command` - the command to send
      Returns:
        response from NNTP server
      Throws:
        `NntpException` - if an I/O or NNTP related error occurs

    - #### setDebug

          public void setDebug(boolean debug)

      Set debugging state. Debugging information is sent to System.out
      Parameters:
        `debug` - `true` turns debugging on

    - #### getDebug

          public boolean getDebug()

      Get debugging state.
      Returns:
        `true` if debugging is on

    - #### getDebugStream

          public java.io.PrintStream getDebugStream()

      Gets PrintStream used in reporting debug statements. Default PrintStream is System.out
      Returns:
        the PrintSteam used in debugging
      See Also:
        `PrintStream`

    - #### setDebugStream

          public void setDebugStream(java.io.PrintStream debugStream)

      Sets PrintStream used in reporting debug statements. Default PrintStream is System.out
      Parameters:
        `debugStream` - the PrintStream to send debug statements to
      See Also:
        `PrintStream`

Copyright © JSCAPE LLC. 1999-2021. All Rights Reserved