|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnan.nntp.NNTPClientImpl
An implementation of the NNTP Client interface.
Field Summary | |
static int |
NNTP_BODY_OK
The status response for a successful BODY command. |
static int |
NNTP_CONNECT_NO_POSTING
The status response for NNTP connections that forbid posting. |
static int |
NNTP_CONNECT_OK
The status response for NNTP connections that allow posting. |
static int |
NNTP_DISCONNECT_OK
The status response for disconnecting from the NNTP server. |
static int |
NNTP_GROUP_OK
The status response for a successful GROUP command. |
static int |
NNTP_HEAD_OK
The status response for a successful HEAD command. |
static int |
NNTP_LIST_OK
The status response for successful LIST command. |
static int |
NNTP_NEWGROUPS_OK
The status response for a successful NEWGROUPS command. |
static int |
NNTP_NEWNEWS_OK
The status response for a successful NEWNEWS command. |
static int |
NNTP_POST_CONTINUE
The status response for POST command. |
static int |
NNTP_POST_OK
The status response for a successful POST command. |
protected java.io.BufferedReader |
reader
|
protected java.io.PrintWriter |
writer
|
Constructor Summary | |
NNTPClientImpl()
Creates a new NNTPClientImpl object. |
Method Summary | |
void |
connect(java.lang.String hostname,
int port)
Connects to the NNTP server. |
void |
disconnect()
Disconnects from the server. |
MessageHeader |
getHeader(int article)
Gets the MessageHeader of a newsgroup article. |
MessageHeader |
getHeader(java.lang.String messageId)
Gets the MessageHeader of a newsgroup article. |
Message |
getMessage(int article)
Gets a message from the news server. |
Message |
getMessage(int article,
MessageHeader header)
Gets a message from the news server. |
Message |
getMessage(java.lang.String messageId)
Gets a message from the news server. |
Message |
getMessage(java.lang.String messageId,
MessageHeader header)
Gets a message from the news server. |
java.util.Iterator |
getMessagesSince(Newsgroup newsgroup,
java.util.Date when)
Gets the message IDs in an iterator of all messages added to a Newsgroup since a Date. |
NewsgroupList |
getNewsgroupList()
Gets the list of available Newsgroups from the NNTP server. |
NewsgroupList |
getNewsgroupsSince(java.util.Date when)
Gets the list of Newsgroups added to the server since a Date. |
boolean |
isConnected()
Checks if this client is connected. |
boolean |
isPostingAllowed()
Checks if posting is allowed on this server. |
boolean |
post(Message message)
Posts a message to the NNTP server. |
boolean |
selectNewsgroup(Newsgroup newsgroup)
Selects the current Newsgroup. |
void |
setWaitDialog(WaitDialog dialog)
Sets the wait dialog that is waiting on a task to finish. |
static void |
test()
A method to test this class for correctness. |
java.lang.String |
toString()
Returns a String representation of this NNTPClient. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected java.io.BufferedReader reader
protected java.io.PrintWriter writer
public static final int NNTP_CONNECT_OK
public static final int NNTP_CONNECT_NO_POSTING
public static final int NNTP_DISCONNECT_OK
public static final int NNTP_LIST_OK
public static final int NNTP_POST_CONTINUE
public static final int NNTP_POST_OK
public static final int NNTP_GROUP_OK
public static final int NNTP_HEAD_OK
public static final int NNTP_BODY_OK
public static final int NNTP_NEWNEWS_OK
public static final int NNTP_NEWGROUPS_OK
Constructor Detail |
public NNTPClientImpl()
Method Detail |
public void connect(java.lang.String hostname, int port) throws NNTPConnectException
connect
in interface NNTPClient
hostname
- The NNTP server's hostname.port
- The NNTP server's port.
NNTPConnectException
- if the connection failed.public boolean isConnected()
isConnected
in interface NNTPClient
public void disconnect()
disconnect
in interface NNTPClient
public boolean isPostingAllowed()
isPostingAllowed
in interface NNTPClient
public NewsgroupList getNewsgroupList() throws UnconnectedException
getNewsgroupList
in interface NNTPClient
UnconnectedException
- if this client is not connected.
NNTPException
- if an unknown NNTP problem occurs.public boolean selectNewsgroup(Newsgroup newsgroup) throws UnconnectedException
selectNewsgroup
in interface NNTPClient
newsgroup
- The Newsgroup to select.
UnconnectedException
- if this client is not connected.public NewsgroupList getNewsgroupsSince(java.util.Date when) throws UnconnectedException
getNewsgroupsSince
in interface NNTPClient
when
- The Date after which the newsgroups were added.
UnconnectedException
- if this client is not connected.
NNTPException
- if an unknown NNTP problem occurs.public java.util.Iterator getMessagesSince(Newsgroup newsgroup, java.util.Date when) throws UnconnectedException
getMessagesSince
in interface NNTPClient
newsgroup
- The Newsgroup to check for new messages in.when
- The Date after which the messages were added.
UnconnectedException
- if this client is not connected.
NNTPException
- if an unknown NNTP problem occurs.public MessageHeader getHeader(int article) throws UnconnectedException, InvalidArticleException
getHeader
in interface NNTPClient
article
- The article ID in the current group.
UnconnectedException
- if this client is not connected.
InvalidArticleException
- if the article does not exist on this
server.public MessageHeader getHeader(java.lang.String messageId) throws UnconnectedException, InvalidArticleException
getHeader
in interface NNTPClient
messageId
- The message ID of the article.
UnconnectedException
- if this client is not connected.
InvalidArticleException
- if the article does not exist on this
server.public Message getMessage(int article, MessageHeader header) throws UnconnectedException, InvalidArticleException
getMessage
in interface NNTPClient
article
- The article ID in the current group.header
- The MessageHeader of this article.
UnconnectedException
- if this client is not connected.
InvalidArticleException
- if the article does not exist on this
server.public Message getMessage(int article) throws UnconnectedException, InvalidArticleException
getMessage
in interface NNTPClient
article
- The article ID in the current group.
UnconnectedException
- if this client is not connected.
InvalidArticleException
- if the article does not exist on this
server.public Message getMessage(java.lang.String messageId, MessageHeader header) throws UnconnectedException, InvalidArticleException
getMessage
in interface NNTPClient
messageId
- The message ID of the article.header
- The MessageHeader of this article.
UnconnectedException
- if this client is not connected.
InvalidArticleException
- if the article does not exist on this
server.public Message getMessage(java.lang.String messageId) throws UnconnectedException, InvalidArticleException
getMessage
in interface NNTPClient
messageId
- The message ID of the article.
UnconnectedException
- if this client is not connected.
InvalidArticleException
- if the article does not exist on this
server.public boolean post(Message message) throws UnconnectedException
post
in interface NNTPClient
message
- The Message to post.
UnconnectedException
- if this client is not connected.public void setWaitDialog(WaitDialog dialog)
dialog
- The WaitDialog.public java.lang.String toString()
public static void test()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |