com.croftsoft.core.net.news
Class NntpSocket

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

public class NntpSocket
extends Socket
implements NntpConstants

Implements NNTP as given by RFC 977.

Since:
1997-05-10
Version:
2001-08-03
See Also:
"Common NNTP Extensions (AUTHINFO), http://www.mibsoftware.com/userkt/nntpext/0032.htm"
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
 
Constructor Summary
NntpSocket(String nntpServerHost, Log log)
          Be sure to call command_QUIT() when done.
 
Method Summary
 String command_QUIT()
          Sends COMMAND_QUIT and then closes the NNTPSocket.
 String command(String command)
          Sends command + CR_LF to the server.
 BufferedReader getBufferedReader()
           
 Log getLog()
           
 boolean getPostingAllowed()
          Returns true if posting to this server is allowed.
 String getResponseCode()
          Returns the response code for the last command.
 Vector load_response_text()
          Loads the response_text from the NNTPSocket InputStream.
 Vector response_text()
          Returns the response text, a Vector of String, for the last command.
 void setLog(Log log)
           
 
Methods inherited from class java.net.Socket
bind, close, connect, connect, getChannel, getInetAddress, getInputStream, getKeepAlive, getLocalAddress, getLocalPort, getLocalSocketAddress, getOOBInline, getOutputStream, getPort, getReceiveBufferSize, getRemoteSocketAddress, getReuseAddress, getSendBufferSize, getSoLinger, getSoTimeout, getTcpNoDelay, getTrafficClass, isBound, isClosed, isConnected, isInputShutdown, isOutputShutdown, sendUrgentData, setKeepAlive, setOOBInline, setPerformancePreferences, setReceiveBufferSize, setReuseAddress, setSendBufferSize, setSocketImplFactory, setSoLinger, setSoTimeout, setTcpNoDelay, setTrafficClass, shutdownInput, shutdownOutput, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NntpSocket

public NntpSocket(String nntpServerHost,
                  Log log)
           throws IOException
Be sure to call command_QUIT() when done.

Throws:
IOException
Method Detail

getBufferedReader

public BufferedReader getBufferedReader()

getResponseCode

public String getResponseCode()
Returns the response code for the last command.


response_text

public Vector response_text()
Returns the response text, a Vector of String, for the last command.


getPostingAllowed

public boolean getPostingAllowed()
Returns true if posting to this server is allowed.


load_response_text

public Vector load_response_text()
                          throws IOException
Loads the response_text from the NNTPSocket InputStream. Decodes it as well.

Throws:
IOException

command

public String command(String command)
               throws IOException
Sends command + CR_LF to the server. Returns the responseCode.

Throws:
IOException

command_QUIT

public String command_QUIT()
                    throws IOException
Sends COMMAND_QUIT and then closes the NNTPSocket.

Throws:
IOException

getLog

public Log getLog()

setLog

public void setLog(Log log)

CroftSoft Javadoc

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