Java Doc for NNTP.java in  » Net » Apache-commons-net-1.4.1 » org » apache » commons » net » nntp » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Net » Apache commons net 1.4.1 » org.apache.commons.net.nntp 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.commons.net.SocketClient
      org.apache.commons.net.nntp.NNTP

All known Subclasses:   org.apache.commons.net.nntp.NNTPClient,
NNTP
public class NNTP extends SocketClient (Code)
The NNTP class is not meant to be used by itself and is provided only so that you may easily implement your own NNTP client if you so desire. If you have no need to perform your own implementation, you should use org.apache.commons.net.nntp.NNTPClient . The NNTP class is made public to provide access to various NNTP constants and to make it easier for adventurous programmers (or those with special needs) to interact with the NNTP protocol and implement their own clients. A set of methods with names corresponding to the NNTP command names are provided to facilitate this interaction.

You should keep in mind that the NNTP server may choose to prematurely close a connection if the client has been idle for longer than a given time period or if the server is being shutdown by the operator or some other reason. The NNTP class will detect a premature NNTP server connection closing when it receives a org.apache.commons.net.nntp.NNTPReply.SERVICE_DISCONTINUED NNTPReply.SERVICE_DISCONTINUED response to a command. When that occurs, the NNTP class method encountering that reply will throw an org.apache.commons.net.nntp.NNTPConnectionClosedException . NNTPConectionClosedException is a subclass of IOException and therefore need not be caught separately, but if you are going to catch it separately, its catch block must appear before the more general IOException catch block. When you encounter an org.apache.commons.net.nntp.NNTPConnectionClosedException , you must disconnect the connection with NNTP.disconnect disconnect() to properly clean up the system resources used by NNTP. Before disconnecting, you may check the last reply code and text with NNTP.getReplyCode getReplyCode and NNTP.getReplyString getReplyString .

Rather than list it separately for each method, we mention here that every method communicating with the server and throwing an IOException can also throw a org.apache.commons.net.MalformedServerReplyException , which is a subclass of IOException. A MalformedServerReplyException will be thrown when the reply received from the server deviates enough from the protocol specification that it cannot be interpreted in a useful manner despite attempts to be as lenient as possible.


author:
   Daniel F. Savarese
author:
   Rory Winston
author:
   Ted Wise
See Also:   NNTPClient
See Also:   NNTPConnectionClosedException
See Also:   org.apache.commons.net.MalformedServerReplyException



Field Summary
final public static  intDEFAULT_PORT
     The default NNTP port.
protected  ProtocolCommandSupport_commandSupport_
     A ProtocolCommandSupport object used to manage the registering of ProtocolCommandListeners and te firing of ProtocolCommandEvents.
 boolean_isAllowedToPost
    
protected  BufferedReader_reader_
     Wraps SocketClient._input_ to communicate with server.
 int_replyCode
    
 String_replyString
    
protected  BufferedWriter_writer_
     Wraps SocketClient._output_ to communicate with server.

Constructor Summary
public  NNTP()
     The default NNTP constructor.

Method Summary
protected  void_connectAction_()
     Initiates control connections and gets initial reply, determining if the client is allowed to post to the server.
public  voidaddProtocolCommandListener(ProtocolCommandListener listener)
     Adds a ProtocolCommandListener.
public  intarticle(String messageId)
     A convenience method to send the NNTP ARTICLE command to the server, receive the initial reply, and return the reply code.


Parameters:
  messageId - The message identifier of the requested article,including the encapsulating < and > characters.

public  intarticle(int articleNumber)
     A convenience method to send the NNTP ARTICLE command to the server, receive the initial reply, and return the reply code.


Parameters:
  articleNumber - The number of the article to request from thecurrently selected newsgroup.

public  intarticle()
     A convenience method to send the NNTP ARTICLE command to the server, receive the initial reply, and return the reply code.

The reply code received from the server.
exception:
  NNTPConnectionClosedException - If the NNTP server prematurely closes the connection as a resultof the client being idle or some other reason causing the serverto send NNTP reply code 400.

public  intauthinfoPass(String password)
     A convenience method to send the AUTHINFO PASS command to the server, receive the reply, and return the reply code.
public  intauthinfoUser(String username)
     A convenience method to send the AUTHINFO USER command to the server, receive the reply, and return the reply code.
public  intbody(String messageId)
     A convenience method to send the NNTP BODY command to the server, receive the initial reply, and return the reply code.


Parameters:
  messageId - The message identifier of the requested article,including the encapsulating < and > characters.

public  intbody(int articleNumber)
     A convenience method to send the NNTP BODY command to the server, receive the initial reply, and return the reply code.


Parameters:
  articleNumber - The number of the article to request from thecurrently selected newsgroup.

public  intbody()
     A convenience method to send the NNTP BODY command to the server, receive the initial reply, and return the reply code.

The reply code received from the server.
exception:
  NNTPConnectionClosedException - If the NNTP server prematurely closes the connection as a resultof the client being idle or some other reason causing the serverto send NNTP reply code 400.

public  voiddisconnect()
     Closes the connection to the NNTP server and sets to null some internal data so that the memory may be reclaimed by the garbage collector.
public  intgetReply()
     Fetches a reply from the NNTP server and returns the integer reply code.
public  intgetReplyCode()
     Returns the integer value of the reply code of the last NNTP reply.
public  StringgetReplyString()
     Returns the entire text of the last NNTP server response exactly as it was received, not including the end of line marker.
public  intgroup(String newsgroup)
     A convenience method to send the NNTP GROUP command to the server, receive the reply, and return the reply code.


Parameters:
  newsgroup - The name of the newsgroup to select.

public  inthead(String messageId)
     A convenience method to send the NNTP HEAD command to the server, receive the initial reply, and return the reply code.


Parameters:
  messageId - The message identifier of the requested article,including the encapsulating < and > characters.

public  inthead(int articleNumber)
     A convenience method to send the NNTP HEAD command to the server, receive the initial reply, and return the reply code.


Parameters:
  articleNumber - The number of the article to request from thecurrently selected newsgroup.

public  inthead()
     A convenience method to send the NNTP HEAD command to the server, receive the initial reply, and return the reply code.

The reply code received from the server.
exception:
  NNTPConnectionClosedException - If the NNTP server prematurely closes the connection as a resultof the client being idle or some other reason causing the serverto send NNTP reply code 400.

public  inthelp()
     A convenience method to send the NNTP HELP command to the server, receive the reply, and return the reply code.

The reply code received from the server.
exception:
  NNTPConnectionClosedException - If the NNTP server prematurely closes the connection as a resultof the client being idle or some other reason causing the serverto send NNTP reply code 400.

public  intihave(String messageId)
     A convenience method to send the NNTP IHAVE command to the server, receive the reply, and return the reply code.


Parameters:
  messageId - The article identifier,including the encapsulating < and > characters.

public  booleanisAllowedToPost()
     Indicates whether or not the client is allowed to post articles to the server it is currently connected to.
public  intlast()
     A convenience method to send the NNTP LAST command to the server, receive the reply, and return the reply code.

The reply code received from the server.
exception:
  NNTPConnectionClosedException - If the NNTP server prematurely closes the connection as a resultof the client being idle or some other reason causing the serverto send NNTP reply code 400.

public  intlist()
     A convenience method to send the NNTP LIST command to the server, receive the reply, and return the reply code.

The reply code received from the server.
exception:
  NNTPConnectionClosedException - If the NNTP server prematurely closes the connection as a resultof the client being idle or some other reason causing the serverto send NNTP reply code 400.

public  intlistActive(String wildmat)
     A convenience wrapper for the extended LIST command that takes an argument, allowing us to selectively list multiple groups.


Parameters:
  wildmat - A wildmat (pseudo-regex) pattern.

public  intnewgroups(String date, String time, boolean GMT, String distributions)
     A convenience method to send the NNTP NEWGROUPS command to the server, receive the reply, and return the reply code.


Parameters:
  date - The date after which to check for new groups.Date format is YYMMDD
Parameters:
  time - The time after which to check for new groups.Time format is HHMMSS using a 24-hour clock.
Parameters:
  GMT - True if the time is in GMT, false if local server time.
Parameters:
  distributions - Comma-separated distribution list to check fornew groups.

public  intnewnews(String newsgroups, String date, String time, boolean GMT, String distributions)
     A convenience method to send the NNTP NEWGROUPS command to the server, receive the reply, and return the reply code.


Parameters:
  newsgroups - A comma-separated list of newsgroups to check for newnews.
Parameters:
  date - The date after which to check for new news.Date format is YYMMDD
Parameters:
  time - The time after which to check for new news.Time format is HHMMSS using a 24-hour clock.
Parameters:
  GMT - True if the time is in GMT, false if local server time.
Parameters:
  distributions - Comma-separated distribution list to check fornew news.

public  intnext()
     A convenience method to send the NNTP NEXT command to the server, receive the reply, and return the reply code.

The reply code received from the server.
exception:
  NNTPConnectionClosedException - If the NNTP server prematurely closes the connection as a resultof the client being idle or some other reason causing the serverto send NNTP reply code 400.

public  intpost()
     A convenience method to send the NNTP POST command to the server, receive the reply, and return the reply code.

The reply code received from the server.
exception:
  NNTPConnectionClosedException - If the NNTP server prematurely closes the connection as a resultof the client being idle or some other reason causing the serverto send NNTP reply code 400.

public  intquit()
     A convenience method to send the NNTP QUIT command to the server, receive the reply, and return the reply code.

The reply code received from the server.
exception:
  NNTPConnectionClosedException - If the NNTP server prematurely closes the connection as a resultof the client being idle or some other reason causing the serverto send NNTP reply code 400.

public  voidremoveProtocolCommandListener(ProtocolCommandListener listener)
     Removes a ProtocolCommandListener.
public  intsendCommand(String command, String args)
     Sends an NNTP command to the server, waits for a reply and returns the numerical response code.
public  intsendCommand(int command, String args)
     Sends an NNTP command to the server, waits for a reply and returns the numerical response code.
public  intsendCommand(String command)
     Sends an NNTP command with no arguments to the server, waits for a reply and returns the numerical response code.
public  intsendCommand(int command)
     Sends an NNTP command with no arguments to the server, waits for a reply and returns the numerical response code.
public  intstat(String messageId)
     A convenience method to send the NNTP STAT command to the server, receive the initial reply, and return the reply code.


Parameters:
  messageId - The message identifier of the requested article,including the encapsulating < and > characters.

public  intstat(int articleNumber)
     A convenience method to send the NNTP STAT command to the server, receive the initial reply, and return the reply code.


Parameters:
  articleNumber - The number of the article to request from thecurrently selected newsgroup.

public  intstat()
     A convenience method to send the NNTP STAT command to the server, receive the initial reply, and return the reply code.

The reply code received from the server.
exception:
  NNTPConnectionClosedException - If the NNTP server prematurely closes the connection as a resultof the client being idle or some other reason causing the serverto send NNTP reply code 400.

public  intxhdr(String header, String selectedArticles)
     A convenience method to send the NNTP XHDR command to the server, receive the reply, and return the reply code.


Parameters:
  header - a String naming a header line (e.g., "subject").

public  intxover(String selectedArticles)
     A convenience method to send the NNTP XOVER command to the server, receive the reply, and return the reply code.


Parameters:
  selectedArticles - a String representation of the range ofarticle headers required.


Field Detail
DEFAULT_PORT
final public static int DEFAULT_PORT(Code)
The default NNTP port. Its value is 119 according to RFC 977. **



_commandSupport_
protected ProtocolCommandSupport _commandSupport_(Code)
A ProtocolCommandSupport object used to manage the registering of ProtocolCommandListeners and te firing of ProtocolCommandEvents.



_isAllowedToPost
boolean _isAllowedToPost(Code)



_reader_
protected BufferedReader _reader_(Code)
Wraps SocketClient._input_ to communicate with server. Initialized by NNTP._connectAction_ . All server reads should be done through this variable.



_replyCode
int _replyCode(Code)



_replyString
String _replyString(Code)



_writer_
protected BufferedWriter _writer_(Code)
Wraps SocketClient._output_ to communicate with server. Initialized by NNTP._connectAction_ . All server reads should be done through this variable.




Constructor Detail
NNTP
public NNTP()(Code)
The default NNTP constructor. Sets the default port to DEFAULT_PORT and initializes internal data structures for saving NNTP reply information.




Method Detail
_connectAction_
protected void _connectAction_() throws IOException(Code)
Initiates control connections and gets initial reply, determining if the client is allowed to post to the server. Initializes NNTP._reader_ and NNTP._writer_ to wrap SocketClient._input_ and SocketClient._output_ .



addProtocolCommandListener
public void addProtocolCommandListener(ProtocolCommandListener listener)(Code)
Adds a ProtocolCommandListener. Delegates this task to NNTP._commandSupport_ _commandSupport_ .


Parameters:
  listener - The ProtocolCommandListener to add.




article
public int article(String messageId) throws IOException(Code)
A convenience method to send the NNTP ARTICLE command to the server, receive the initial reply, and return the reply code.


Parameters:
  messageId - The message identifier of the requested article,including the encapsulating < and > characters. The reply code received from the server.
exception:
  NNTPConnectionClosedException - If the NNTP server prematurely closes the connection as a resultof the client being idle or some other reason causing the serverto send NNTP reply code 400. This exception may be caught eitheras an IOException or independently as itself.
exception:
  IOException - If an I/O error occurs while either sending thecommand or receiving the server reply.




article
public int article(int articleNumber) throws IOException(Code)
A convenience method to send the NNTP ARTICLE command to the server, receive the initial reply, and return the reply code.


Parameters:
  articleNumber - The number of the article to request from thecurrently selected newsgroup. The reply code received from the server.
exception:
  NNTPConnectionClosedException - If the NNTP server prematurely closes the connection as a resultof the client being idle or some other reason causing the serverto send NNTP reply code 400. This exception may be caught eitheras an IOException or independently as itself.
exception:
  IOException - If an I/O error occurs while either sending thecommand or receiving the server reply.




article
public int article() throws IOException(Code)
A convenience method to send the NNTP ARTICLE command to the server, receive the initial reply, and return the reply code.

The reply code received from the server.
exception:
  NNTPConnectionClosedException - If the NNTP server prematurely closes the connection as a resultof the client being idle or some other reason causing the serverto send NNTP reply code 400. This exception may be caught eitheras an IOException or independently as itself.
exception:
  IOException - If an I/O error occurs while either sending thecommand or receiving the server reply.




authinfoPass
public int authinfoPass(String password) throws IOException(Code)
A convenience method to send the AUTHINFO PASS command to the server, receive the reply, and return the reply code. If this step is required, it should immediately follow the AUTHINFO USER command (See RFC 2980)


Parameters:
  password - a valid password. The reply code received from the server. The server shouldreturn a 281 or 502 for this command.
exception:
  NNTPConnectionClosedException - If the NNTP server prematurely closes the connection as a resultof the client being idle or some other reason causing the serverto send NNTP reply code 400. This exception may be caught eitheras an IOException or independently as itself.
exception:
  IOException - If an I/O error occurs while either sending thecommand or receiving the server reply.




authinfoUser
public int authinfoUser(String username) throws IOException(Code)
A convenience method to send the AUTHINFO USER command to the server, receive the reply, and return the reply code. (See RFC 2980)


Parameters:
  username - A valid username. The reply code received from the server. The server shouldreturn a 381 or 281 for this command.
exception:
  NNTPConnectionClosedException - If the NNTP server prematurely closes the connection as a resultof the client being idle or some other reason causing the serverto send NNTP reply code 400. This exception may be caught eitheras an IOException or independently as itself.
exception:
  IOException - If an I/O error occurs while either sending thecommand or receiving the server reply.




body
public int body(String messageId) throws IOException(Code)
A convenience method to send the NNTP BODY command to the server, receive the initial reply, and return the reply code.


Parameters:
  messageId - The message identifier of the requested article,including the encapsulating < and > characters. The reply code received from the server.
exception:
  NNTPConnectionClosedException - If the NNTP server prematurely closes the connection as a resultof the client being idle or some other reason causing the serverto send NNTP reply code 400. This exception may be caught eitheras an IOException or independently as itself.
exception:
  IOException - If an I/O error occurs while either sending thecommand or receiving the server reply.




body
public int body(int articleNumber) throws IOException(Code)
A convenience method to send the NNTP BODY command to the server, receive the initial reply, and return the reply code.


Parameters:
  articleNumber - The number of the article to request from thecurrently selected newsgroup. The reply code received from the server.
exception:
  NNTPConnectionClosedException - If the NNTP server prematurely closes the connection as a resultof the client being idle or some other reason causing the serverto send NNTP reply code 400. This exception may be caught eitheras an IOException or independently as itself.
exception:
  IOException - If an I/O error occurs while either sending thecommand or receiving the server reply.




body
public int body() throws IOException(Code)
A convenience method to send the NNTP BODY command to the server, receive the initial reply, and return the reply code.

The reply code received from the server.
exception:
  NNTPConnectionClosedException - If the NNTP server prematurely closes the connection as a resultof the client being idle or some other reason causing the serverto send NNTP reply code 400. This exception may be caught eitheras an IOException or independently as itself.
exception:
  IOException - If an I/O error occurs while either sending thecommand or receiving the server reply.




disconnect
public void disconnect() throws IOException(Code)
Closes the connection to the NNTP server and sets to null some internal data so that the memory may be reclaimed by the garbage collector. The reply text and code information from the last command is voided so that the memory it used may be reclaimed.


exception:
  IOException - If an error occurs while disconnecting.




getReply
public int getReply() throws IOException(Code)
Fetches a reply from the NNTP server and returns the integer reply code. After calling this method, the actual reply text can be accessed from NNTP.getReplyString getReplyString . Only use this method if you are implementing your own NNTP client or if you need to fetch a secondary response from the NNTP server.

The integer value of the reply code of the fetched NNTP reply.in response to the command.
exception:
  NNTPConnectionClosedException - If the NNTP server prematurely closes the connection as a resultof the client being idle or some other reason causing the serverto send NNTP reply code 400. This exception may be caught eitheras an IOException or independently as itself.
exception:
  IOException - If an I/O error occurs whilereceiving the server reply.




getReplyCode
public int getReplyCode()(Code)
Returns the integer value of the reply code of the last NNTP reply. You will usually only use this method after you connect to the NNTP server to check that the connection was successful since connect is of type void.

The integer value of the reply code of the last NNTP reply.




getReplyString
public String getReplyString()(Code)
Returns the entire text of the last NNTP server response exactly as it was received, not including the end of line marker.

The entire text from the last NNTP response as a String.




group
public int group(String newsgroup) throws IOException(Code)
A convenience method to send the NNTP GROUP command to the server, receive the reply, and return the reply code.


Parameters:
  newsgroup - The name of the newsgroup to select. The reply code received from the server.
exception:
  NNTPConnectionClosedException - If the NNTP server prematurely closes the connection as a resultof the client being idle or some other reason causing the serverto send NNTP reply code 400. This exception may be caught eitheras an IOException or independently as itself.
exception:
  IOException - If an I/O error occurs while either sending thecommand or receiving the server reply.




head
public int head(String messageId) throws IOException(Code)
A convenience method to send the NNTP HEAD command to the server, receive the initial reply, and return the reply code.


Parameters:
  messageId - The message identifier of the requested article,including the encapsulating < and > characters. The reply code received from the server.
exception:
  NNTPConnectionClosedException - If the NNTP server prematurely closes the connection as a resultof the client being idle or some other reason causing the serverto send NNTP reply code 400. This exception may be caught eitheras an IOException or independently as itself.
exception:
  IOException - If an I/O error occurs while either sending thecommand or receiving the server reply.




head
public int head(int articleNumber) throws IOException(Code)
A convenience method to send the NNTP HEAD command to the server, receive the initial reply, and return the reply code.


Parameters:
  articleNumber - The number of the article to request from thecurrently selected newsgroup. The reply code received from the server.
exception:
  NNTPConnectionClosedException - If the NNTP server prematurely closes the connection as a resultof the client being idle or some other reason causing the serverto send NNTP reply code 400. This exception may be caught eitheras an IOException or independently as itself.
exception:
  IOException - If an I/O error occurs while either sending thecommand or receiving the server reply.




head
public int head() throws IOException(Code)
A convenience method to send the NNTP HEAD command to the server, receive the initial reply, and return the reply code.

The reply code received from the server.
exception:
  NNTPConnectionClosedException - If the NNTP server prematurely closes the connection as a resultof the client being idle or some other reason causing the serverto send NNTP reply code 400. This exception may be caught eitheras an IOException or independently as itself.
exception:
  IOException - If an I/O error occurs while either sending thecommand or receiving the server reply.




help
public int help() throws IOException(Code)
A convenience method to send the NNTP HELP command to the server, receive the reply, and return the reply code.

The reply code received from the server.
exception:
  NNTPConnectionClosedException - If the NNTP server prematurely closes the connection as a resultof the client being idle or some other reason causing the serverto send NNTP reply code 400. This exception may be caught eitheras an IOException or independently as itself.
exception:
  IOException - If an I/O error occurs while either sending thecommand or receiving the server reply.




ihave
public int ihave(String messageId) throws IOException(Code)
A convenience method to send the NNTP IHAVE command to the server, receive the reply, and return the reply code.


Parameters:
  messageId - The article identifier,including the encapsulating < and > characters. The reply code received from the server.
exception:
  NNTPConnectionClosedException - If the NNTP server prematurely closes the connection as a resultof the client being idle or some other reason causing the serverto send NNTP reply code 400. This exception may be caught eitheras an IOException or independently as itself.
exception:
  IOException - If an I/O error occurs while either sending thecommand or receiving the server reply.




isAllowedToPost
public boolean isAllowedToPost()(Code)
Indicates whether or not the client is allowed to post articles to the server it is currently connected to.

True if the client can post articles to the server, falseotherwise.




last
public int last() throws IOException(Code)
A convenience method to send the NNTP LAST command to the server, receive the reply, and return the reply code.

The reply code received from the server.
exception:
  NNTPConnectionClosedException - If the NNTP server prematurely closes the connection as a resultof the client being idle or some other reason causing the serverto send NNTP reply code 400. This exception may be caught eitheras an IOException or independently as itself.
exception:
  IOException - If an I/O error occurs while either sending thecommand or receiving the server reply.




list
public int list() throws IOException(Code)
A convenience method to send the NNTP LIST command to the server, receive the reply, and return the reply code.

The reply code received from the server.
exception:
  NNTPConnectionClosedException - If the NNTP server prematurely closes the connection as a resultof the client being idle or some other reason causing the serverto send NNTP reply code 400. This exception may be caught eitheras an IOException or independently as itself.
exception:
  IOException - If an I/O error occurs while either sending thecommand or receiving the server reply.




listActive
public int listActive(String wildmat) throws IOException(Code)
A convenience wrapper for the extended LIST command that takes an argument, allowing us to selectively list multiple groups.


Parameters:
  wildmat - A wildmat (pseudo-regex) pattern. See RFC 2980 fordetails. the reply code received from the server.
throws:
  IOException -




newgroups
public int newgroups(String date, String time, boolean GMT, String distributions) throws IOException(Code)
A convenience method to send the NNTP NEWGROUPS command to the server, receive the reply, and return the reply code.


Parameters:
  date - The date after which to check for new groups.Date format is YYMMDD
Parameters:
  time - The time after which to check for new groups.Time format is HHMMSS using a 24-hour clock.
Parameters:
  GMT - True if the time is in GMT, false if local server time.
Parameters:
  distributions - Comma-separated distribution list to check fornew groups. Set to null if no distributions. The reply code received from the server.
exception:
  NNTPConnectionClosedException - If the NNTP server prematurely closes the connection as a resultof the client being idle or some other reason causing the serverto send NNTP reply code 400. This exception may be caught eitheras an IOException or independently as itself.
exception:
  IOException - If an I/O error occurs while either sending thecommand or receiving the server reply.




newnews
public int newnews(String newsgroups, String date, String time, boolean GMT, String distributions) throws IOException(Code)
A convenience method to send the NNTP NEWGROUPS command to the server, receive the reply, and return the reply code.


Parameters:
  newsgroups - A comma-separated list of newsgroups to check for newnews.
Parameters:
  date - The date after which to check for new news.Date format is YYMMDD
Parameters:
  time - The time after which to check for new news.Time format is HHMMSS using a 24-hour clock.
Parameters:
  GMT - True if the time is in GMT, false if local server time.
Parameters:
  distributions - Comma-separated distribution list to check fornew news. Set to null if no distributions. The reply code received from the server.
exception:
  NNTPConnectionClosedException - If the NNTP server prematurely closes the connection as a resultof the client being idle or some other reason causing the serverto send NNTP reply code 400. This exception may be caught eitheras an IOException or independently as itself.
exception:
  IOException - If an I/O error occurs while either sending thecommand or receiving the server reply.




next
public int next() throws IOException(Code)
A convenience method to send the NNTP NEXT command to the server, receive the reply, and return the reply code.

The reply code received from the server.
exception:
  NNTPConnectionClosedException - If the NNTP server prematurely closes the connection as a resultof the client being idle or some other reason causing the serverto send NNTP reply code 400. This exception may be caught eitheras an IOException or independently as itself.
exception:
  IOException - If an I/O error occurs while either sending thecommand or receiving the server reply.




post
public int post() throws IOException(Code)
A convenience method to send the NNTP POST command to the server, receive the reply, and return the reply code.

The reply code received from the server.
exception:
  NNTPConnectionClosedException - If the NNTP server prematurely closes the connection as a resultof the client being idle or some other reason causing the serverto send NNTP reply code 400. This exception may be caught eitheras an IOException or independently as itself.
exception:
  IOException - If an I/O error occurs while either sending thecommand or receiving the server reply.




quit
public int quit() throws IOException(Code)
A convenience method to send the NNTP QUIT command to the server, receive the reply, and return the reply code.

The reply code received from the server.
exception:
  NNTPConnectionClosedException - If the NNTP server prematurely closes the connection as a resultof the client being idle or some other reason causing the serverto send NNTP reply code 400. This exception may be caught eitheras an IOException or independently as itself.
exception:
  IOException - If an I/O error occurs while either sending thecommand or receiving the server reply.




removeProtocolCommandListener
public void removeProtocolCommandListener(ProtocolCommandListener listener)(Code)
Removes a ProtocolCommandListener. Delegates this task to NNTP._commandSupport_ _commandSupport_ .


Parameters:
  listener - The ProtocolCommandListener to remove.




sendCommand
public int sendCommand(String command, String args) throws IOException(Code)
Sends an NNTP command to the server, waits for a reply and returns the numerical response code. After invocation, for more detailed information, the actual reply text can be accessed by calling NNTP.getReplyString getReplyString .


Parameters:
  command - The text representation of the NNTP command to send.
Parameters:
  args - The arguments to the NNTP command. If this parameter isset to null, then the command is sent with no argument. The integer value of the NNTP reply code returned by the serverin response to the command.
exception:
  NNTPConnectionClosedException - If the NNTP server prematurely closes the connection as a resultof the client being idle or some other reason causing the serverto send NNTP reply code 400. This exception may be caught eitheras an IOException or independently as itself.
exception:
  IOException - If an I/O error occurs while either sending thecommand or receiving the server reply.




sendCommand
public int sendCommand(int command, String args) throws IOException(Code)
Sends an NNTP command to the server, waits for a reply and returns the numerical response code. After invocation, for more detailed information, the actual reply text can be accessed by calling NNTP.getReplyString getReplyString .


Parameters:
  command - The NNTPCommand constant corresponding to the NNTP commandto send.
Parameters:
  args - The arguments to the NNTP command. If this parameter isset to null, then the command is sent with no argument. The integer value of the NNTP reply code returned by the serverin response to the command.in response to the command.
exception:
  NNTPConnectionClosedException - If the NNTP server prematurely closes the connection as a resultof the client being idle or some other reason causing the serverto send NNTP reply code 400. This exception may be caught eitheras an IOException or independently as itself.
exception:
  IOException - If an I/O error occurs while either sending thecommand or receiving the server reply.




sendCommand
public int sendCommand(String command) throws IOException(Code)
Sends an NNTP command with no arguments to the server, waits for a reply and returns the numerical response code. After invocation, for more detailed information, the actual reply text can be accessed by calling NNTP.getReplyString getReplyString .


Parameters:
  command - The text representation of the NNTP command to send. The integer value of the NNTP reply code returned by the serverin response to the command.in response to the command.
exception:
  NNTPConnectionClosedException - If the NNTP server prematurely closes the connection as a resultof the client being idle or some other reason causing the serverto send NNTP reply code 400. This exception may be caught eitheras an IOException or independently as itself.
exception:
  IOException - If an I/O error occurs while either sending thecommand or receiving the server reply.




sendCommand
public int sendCommand(int command) throws IOException(Code)
Sends an NNTP command with no arguments to the server, waits for a reply and returns the numerical response code. After invocation, for more detailed information, the actual reply text can be accessed by calling NNTP.getReplyString getReplyString .


Parameters:
  command - The NNTPCommand constant corresponding to the NNTP commandto send. The integer value of the NNTP reply code returned by the serverin response to the command.in response to the command.
exception:
  NNTPConnectionClosedException - If the NNTP server prematurely closes the connection as a resultof the client being idle or some other reason causing the serverto send NNTP reply code 400. This exception may be caught eitheras an IOException or independently as itself.
exception:
  IOException - If an I/O error occurs while either sending thecommand or receiving the server reply.




stat
public int stat(String messageId) throws IOException(Code)
A convenience method to send the NNTP STAT command to the server, receive the initial reply, and return the reply code.


Parameters:
  messageId - The message identifier of the requested article,including the encapsulating < and > characters. The reply code received from the server.
exception:
  NNTPConnectionClosedException - If the NNTP server prematurely closes the connection as a resultof the client being idle or some other reason causing the serverto send NNTP reply code 400. This exception may be caught eitheras an IOException or independently as itself.
exception:
  IOException - If an I/O error occurs while either sending thecommand or receiving the server reply.




stat
public int stat(int articleNumber) throws IOException(Code)
A convenience method to send the NNTP STAT command to the server, receive the initial reply, and return the reply code.


Parameters:
  articleNumber - The number of the article to request from thecurrently selected newsgroup. The reply code received from the server.
exception:
  NNTPConnectionClosedException - If the NNTP server prematurely closes the connection as a resultof the client being idle or some other reason causing the serverto send NNTP reply code 400. This exception may be caught eitheras an IOException or independently as itself.
exception:
  IOException - If an I/O error occurs while either sending thecommand or receiving the server reply.




stat
public int stat() throws IOException(Code)
A convenience method to send the NNTP STAT command to the server, receive the initial reply, and return the reply code.

The reply code received from the server.
exception:
  NNTPConnectionClosedException - If the NNTP server prematurely closes the connection as a resultof the client being idle or some other reason causing the serverto send NNTP reply code 400. This exception may be caught eitheras an IOException or independently as itself.
exception:
  IOException - If an I/O error occurs while either sending thecommand or receiving the server reply.




xhdr
public int xhdr(String header, String selectedArticles) throws IOException(Code)
A convenience method to send the NNTP XHDR command to the server, receive the reply, and return the reply code.


Parameters:
  header - a String naming a header line (e.g., "subject"). SeeRFC-1036 for a list of valid header lines.
Parameters:
  selectedArticles - a String representation of the range ofarticle headers required. This may be an article number, or arange of article numbers in the form "XXXX-YYYY", where XXXXand YYYY are valid article numbers in the current group. Italso may be of the form "XXX-", meaning "return XXX and allfollowing articles" In this revision, the last format is notpossible (yet). The reply code received from the server.
exception:
  NNTPConnectionClosedException - If the NNTP server prematurely closes the connection as a resultof the client being idle or some other reason causing the serverto send NNTP reply code 400. This exception may be caught eitheras an IOException or independently as itself.
exception:
  IOException - If an I/O error occurs while either sending thecommand or receiving the server reply.




xover
public int xover(String selectedArticles) throws IOException(Code)
A convenience method to send the NNTP XOVER command to the server, receive the reply, and return the reply code.


Parameters:
  selectedArticles - a String representation of the range ofarticle headers required. This may be an article number, or arange of article numbers in the form "XXXX-YYYY", where XXXXand YYYY are valid article numbers in the current group. Italso may be of the form "XXX-", meaning "return XXX and allfollowing articles" In this revision, the last format is notpossible (yet). The reply code received from the server.
exception:
  NNTPConnectionClosedException - If the NNTP server prematurely closes the connection as a resultof the client being idle or some other reason causing the serverto send NNTP reply code 400. This exception may be caught eitheras an IOException or independently as itself.
exception:
  IOException - If an I/O error occurs while either sending thecommand or receiving the server reply.




Fields inherited from org.apache.commons.net.SocketClient
final public static String NETASCII_EOL(Code)(Java Doc)
protected int _defaultPort_(Code)(Java Doc)
protected InputStream _input_(Code)(Java Doc)
protected boolean _isConnected_(Code)(Java Doc)
protected OutputStream _output_(Code)(Java Doc)
protected SocketFactory _socketFactory_(Code)(Java Doc)
protected Socket _socket_(Code)(Java Doc)
protected int _timeout_(Code)(Java Doc)

Methods inherited from org.apache.commons.net.SocketClient
protected void _connectAction_() throws IOException(Code)(Java Doc)
public void connect(InetAddress host, int port) throws SocketException, IOException(Code)(Java Doc)
public void connect(String hostname, int port) throws SocketException, IOException(Code)(Java Doc)
public void connect(InetAddress host, int port, InetAddress localAddr, int localPort) throws SocketException, IOException(Code)(Java Doc)
public void connect(String hostname, int port, InetAddress localAddr, int localPort) throws SocketException, IOException(Code)(Java Doc)
public void connect(InetAddress host) throws SocketException, IOException(Code)(Java Doc)
public void connect(String hostname) throws SocketException, IOException(Code)(Java Doc)
public void disconnect() throws IOException(Code)(Java Doc)
public int getDefaultPort()(Code)(Java Doc)
public int getDefaultTimeout()(Code)(Java Doc)
public InetAddress getLocalAddress()(Code)(Java Doc)
public int getLocalPort()(Code)(Java Doc)
public InetAddress getRemoteAddress()(Code)(Java Doc)
public int getRemotePort()(Code)(Java Doc)
public int getSoLinger() throws SocketException(Code)(Java Doc)
public int getSoTimeout() throws SocketException(Code)(Java Doc)
public boolean getTcpNoDelay() throws SocketException(Code)(Java Doc)
public boolean isConnected()(Code)(Java Doc)
public void setDefaultPort(int port)(Code)(Java Doc)
public void setDefaultTimeout(int timeout)(Code)(Java Doc)
public void setSoLinger(boolean on, int val) throws SocketException(Code)(Java Doc)
public void setSoTimeout(int timeout) throws SocketException(Code)(Java Doc)
public void setSocketFactory(SocketFactory factory)(Code)(Java Doc)
public void setTcpNoDelay(boolean on) throws SocketException(Code)(Java Doc)
public boolean verifyRemote(Socket socket)(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.