public class NNTPConnector extends java.lang.Object implements Connector
Modifier and Type | Field and Description |
---|---|
static int |
ARTICLE_ALL |
static int |
ARTICLE_BODY |
static int |
ARTICLE_HEADER |
protected java.lang.String |
hostname |
protected boolean |
isConnected |
protected int |
maxArticle |
protected java.lang.String |
password |
protected int |
port |
protected int |
timeout |
protected java.lang.String |
uri |
protected java.lang.String |
username |
Constructor and Description |
---|
NNTPConnector(java.util.Map props)
Creates new NNTPConnector
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
protected void |
connect() |
protected org.apache.commons.net.nntp.Article |
getArticleInfo(int anumber)
It returns the article info for the given article number in the
current newsgroup or null for failure.
|
protected org.apache.commons.net.nntp.Article[] |
getArticleInfo(int lowNumber,
int highNumber)
It returns an array of article info for the given range of articles
in the current newsgroup.
|
org.apache.commons.net.nntp.Article[] |
getArticleInfo(java.lang.String gname,
int anumber,
long tm)
It returns an array of article info for new articles in the specified
newsgroup since the give timestamp.
|
java.util.Date |
getDate(org.apache.commons.net.nntp.Article article)
It parses the date field of an article and returns Date object or
null upon failure.
|
org.apache.commons.net.nntp.NNTPClient |
getNNTPClient() |
java.lang.String |
getReplyString() |
java.lang.String |
getURI() |
boolean |
isAllowedToPost() |
boolean |
isConnected() |
static void |
main(java.lang.String[] args) |
java.lang.String |
nntpGet(java.lang.StringBuffer strBuf,
java.lang.String aid)
It retrieves the entire article of the specific article id from the
current newsgroup.
|
java.lang.String |
nntpGet(java.lang.StringBuffer strBuf,
java.lang.String aid,
int contentType)
It retrieves the content of the article of the specific article id
from the current newsgroup.
|
java.lang.String[] |
nntpListArticles(java.lang.String groupName,
long tm)
It returns an array of article IDs for requested articles in the
specified news group.
|
org.apache.commons.net.nntp.NewsgroupInfo[] |
nntpListGroups(java.lang.String distName,
long tm)
It returns a list of news groups on the NNTP server.
|
java.lang.String |
nntpPost(java.lang.String header,
java.lang.String body)
It posts the article with the header and the body to the current
newsgroup.
|
java.lang.String |
nntpPost(java.lang.String subject,
java.lang.String story,
java.lang.String groupName)
It posts the article with the subject and the story to the current
newsgroup.
|
java.lang.String |
reconnect()
It reconnects and returns null or error message upon failure
|
java.lang.String |
setNewsgroup(java.lang.String groupName)
It sets the current newsgroup and returns null upon success
or the error text otherwise.
|
protected java.lang.String hostname
protected java.lang.String uri
protected java.lang.String username
protected java.lang.String password
protected int port
protected int timeout
protected int maxArticle
protected boolean isConnected
public static final int ARTICLE_ALL
public static final int ARTICLE_HEADER
public static final int ARTICLE_BODY
public NNTPConnector(java.util.Map props) throws java.io.IOException
java.io.IOException
protected void connect() throws java.io.IOException
java.io.IOException
public boolean isConnected()
isConnected
in interface Connector
public java.lang.String reconnect()
public boolean isAllowedToPost()
public java.lang.String nntpGet(java.lang.StringBuffer strBuf, java.lang.String aid) throws java.io.IOException
java.io.IOException
public java.lang.String nntpGet(java.lang.StringBuffer strBuf, java.lang.String aid, int contentType) throws java.io.IOException
java.io.IOException
public java.lang.String nntpPost(java.lang.String header, java.lang.String body) throws java.io.IOException
java.io.IOException
public java.lang.String nntpPost(java.lang.String subject, java.lang.String story, java.lang.String groupName) throws java.io.IOException
java.io.IOException
public org.apache.commons.net.nntp.NewsgroupInfo[] nntpListGroups(java.lang.String distName, long tm) throws java.io.IOException
java.io.IOException
public java.lang.String[] nntpListArticles(java.lang.String groupName, long tm) throws java.io.IOException
java.io.IOException
protected org.apache.commons.net.nntp.Article[] getArticleInfo(int lowNumber, int highNumber) throws java.io.IOException
java.io.IOException
protected org.apache.commons.net.nntp.Article getArticleInfo(int anumber) throws java.io.IOException
java.io.IOException
public org.apache.commons.net.nntp.Article[] getArticleInfo(java.lang.String gname, int anumber, long tm) throws java.io.IOException
java.io.IOException
public java.util.Date getDate(org.apache.commons.net.nntp.Article article)
public java.lang.String getReplyString()
public java.lang.String setNewsgroup(java.lang.String groupName)
public org.apache.commons.net.nntp.NNTPClient getNNTPClient()
public static void main(java.lang.String[] args)