com.croftsoft.core.net.news
Class NntpLib

java.lang.Object
  extended by com.croftsoft.core.net.news.NntpLib
All Implemented Interfaces:
NntpConstants

public final class NntpLib
extends Object
implements NntpConstants

Static library methods for NNTP (RFC 977).

Since:
2001-07-23
Version:
2001-08-03
Author:
David Wallace Croft

Field Summary
 
Fields inherited from interface com.croftsoft.core.net.news.NntpConstants
COMMAND_ARTICLE, COMMAND_AUTHINFO, COMMAND_BODY, COMMAND_GROUP, COMMAND_HEAD, COMMAND_HELP, COMMAND_IHAVE, COMMAND_LAST, COMMAND_LIST, COMMAND_NEWGROUPS, COMMAND_NEWNEWS, COMMAND_NEXT, COMMAND_POST, COMMAND_QUIT, COMMAND_SLAVE, COMMAND_STAT, CR_LF, NNTP_PORT
 
Method Summary
static String authenticate(NntpSocket nntpSocket, String username, String password)
          Sends username and password.
static String decodeLine(String line)
          Replaces starting ".." with ".".
static void decodeLines(String[] lines)
          Replaces lines that start with ".." with ".".
static String encode(String messageBody)
          Encodes a message body in preparation for an NNTP POST transmission.
static StringBuffer encodeLines(String[] lines)
          Replaces lines that start with "." with "..", appends CR_LF to each line, then adds a final line of "." + CR_LF.
static void main(String[] args)
          Posts a test message to a test newsgroup.
static String post(String nntpServer, Identifier identifier, UsenetMessage usenetMessage, Log log)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

main

public static void main(String[] args)
                 throws IOException
Posts a test message to a test newsgroup.

Throws:
IOException

authenticate

public static String authenticate(NntpSocket nntpSocket,
                                  String username,
                                  String password)
                           throws IOException,
                                  SecurityException
Sends username and password. Synchronizes on the NntpSocket.

Throws:
IOException
SecurityException

encodeLines

public static StringBuffer encodeLines(String[] lines)
Replaces lines that start with "." with "..", appends CR_LF to each line, then adds a final line of "." + CR_LF.


encode

public static String encode(String messageBody)
Encodes a message body in preparation for an NNTP POST transmission.
 return encodeLines (
   StringLib.toStringArray ( messageBody ) ).toString ( );
 


decodeLines

public static void decodeLines(String[] lines)
Replaces lines that start with ".." with ".".


decodeLine

public static String decodeLine(String line)
Replaces starting ".." with ".".


post

public static String post(String nntpServer,
                          Identifier identifier,
                          UsenetMessage usenetMessage,
                          Log log)
                   throws IOException
Throws:
IOException

CroftSoft Javadoc

CroftSoft Core Javadoc (2008-09-28 20:58:02)