Class NNTPClient
- java.lang.Object
-
- org.apache.commons.net.SocketClient
-
- org.apache.commons.net.nntp.NNTP
-
- org.apache.commons.net.nntp.NNTPClient
-
public class NNTPClient extends NNTP
NNTPClient encapsulates all the functionality necessary to post and retrieve articles from an NNTP server. As with all classes derived fromSocketClient
, you must first connect to the server withconnect
before doing anything, and finallydisconnect()
after you're completely finished interacting with the server. Remember that theisAllowedToPost()
method is defined inNNTP
.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
NNTPReply.SERVICE_DISCONTINUED
response to a command. When that occurs, the NNTP class method encountering that reply will throw anNNTPConnectionClosedException
.NNTPConectionClosedException
is a subclass ofIOException
and therefore need not be caught separately, but if you are going to catch it separately, its catch block must appear before the more generalIOException
catch block. When you encounter anNNTPConnectionClosedException
, you must disconnect the connection withdisconnect()
to properly clean up the system resources used by NNTP. Before disconnecting, you may check the last reply code and text withgetReplyCode
andgetReplyString
.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
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.
-
-
Field Summary
-
Fields inherited from class org.apache.commons.net.nntp.NNTP
_commandSupport_, _reader_, _writer_, DEFAULT_PORT
-
Fields inherited from class org.apache.commons.net.SocketClient
_defaultPort_, _hostname_, _input_, _output_, _serverSocketFactory_, _socket_, _socketFactory_, _timeout_, connectTimeout, NETASCII_EOL
-
-
Constructor Summary
Constructors Constructor Description NNTPClient()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description boolean
authenticate(java.lang.String username, java.lang.String password)
Log into a news server by sending the AUTHINFO USER/AUTHINFO PASS command sequence.boolean
completePendingCommand()
There are a few NNTPClient methods that do not complete the entire sequence of NNTP commands to complete a transaction.java.io.Writer
forwardArticle(java.lang.String articleId)
java.lang.Iterable<Article>
iterateArticleInfo(long lowArticleNumber, long highArticleNumber)
Return article headers for all articles between lowArticleNumber and highArticleNumber, inclusively, using the XOVER command.java.lang.Iterable<java.lang.String>
iterateNewNews(NewGroupsOrNewsQuery query)
List all new articles added to the NNTP server since a particular date subject to the conditions of the specified query.java.lang.Iterable<java.lang.String>
iterateNewNewsgroupListing(NewGroupsOrNewsQuery query)
List all new newsgroups added to the NNTP server since a particular date subject to the conditions of the specified query.java.lang.Iterable<NewsgroupInfo>
iterateNewNewsgroups(NewGroupsOrNewsQuery query)
List all new newsgroups added to the NNTP server since a particular date subject to the conditions of the specified query.java.lang.Iterable<java.lang.String>
iterateNewsgroupListing()
List all newsgroups served by the NNTP server.java.lang.Iterable<java.lang.String>
iterateNewsgroupListing(java.lang.String wildmat)
List the newsgroups that match a given pattern.java.lang.Iterable<NewsgroupInfo>
iterateNewsgroups()
List all newsgroups served by the NNTP server.java.lang.Iterable<NewsgroupInfo>
iterateNewsgroups(java.lang.String wildmat)
List the newsgroups that match a given pattern.java.lang.String
listHelp()
List the command help from the server.java.lang.String[]
listNewNews(NewGroupsOrNewsQuery query)
List all new articles added to the NNTP server since a particular date subject to the conditions of the specified query.NewsgroupInfo[]
listNewNewsgroups(NewGroupsOrNewsQuery query)
List all new newsgroups added to the NNTP server since a particular date subject to the conditions of the specified query.NewsgroupInfo[]
listNewsgroups()
List all newsgroups served by the NNTP server.NewsgroupInfo[]
listNewsgroups(java.lang.String wildmat)
List the newsgroups that match a given pattern.java.lang.String[]
listOverviewFmt()
Send a "LIST OVERVIEW.FMT" command to the server.boolean
logout()
Logs out of the news server gracefully by sending the QUIT command.java.io.Writer
postArticle()
Post an article to the NNTP server.java.io.Reader
retrieveArticle()
Same asretrieveArticle((String) null)
Note: the return can be cast to aBufferedReader
java.io.Reader
retrieveArticle(int articleNumber)
Deprecated.3.0 useretrieveArticle(long)
insteadjava.io.Reader
retrieveArticle(int articleNumber, ArticlePointer pointer)
Deprecated.3.0 useretrieveArticle(long, ArticleInfo)
insteadjava.io.BufferedReader
retrieveArticle(long articleNumber)
Same asretrieveArticle(articleNumber, null)
java.io.BufferedReader
retrieveArticle(long articleNumber, ArticleInfo pointer)
Retrieves an article from the currently selected newsgroup.java.io.Reader
retrieveArticle(java.lang.String articleId)
Same asretrieveArticle(articleId, (ArticleInfo) null)
Note: the return can be cast to aBufferedReader
java.io.BufferedReader
retrieveArticle(java.lang.String articleId, ArticleInfo pointer)
Retrieves an article from the NNTP server.java.io.Reader
retrieveArticle(java.lang.String articleId, ArticlePointer pointer)
Deprecated.3.0 useretrieveArticle(String, ArticleInfo)
insteadjava.io.Reader
retrieveArticleBody()
Same asretrieveArticleBody(null)
Note: the return can be cast to aBufferedReader
java.io.Reader
retrieveArticleBody(int a)
Deprecated.3.0 useretrieveArticleBody(long)
insteadjava.io.Reader
retrieveArticleBody(int a, ArticlePointer ap)
Deprecated.3.0 useretrieveArticleBody(long, ArticleInfo)
insteadjava.io.BufferedReader
retrieveArticleBody(long articleNumber)
Same asretrieveArticleBody(articleNumber, null)
java.io.BufferedReader
retrieveArticleBody(long articleNumber, ArticleInfo pointer)
Retrieves an article body from the currently selected newsgroup.java.io.Reader
retrieveArticleBody(java.lang.String articleId)
Same asretrieveArticleBody(articleId, (ArticleInfo) null)
Note: the return can be cast to aBufferedReader
java.io.BufferedReader
retrieveArticleBody(java.lang.String articleId, ArticleInfo pointer)
Retrieves an article body from the NNTP server.java.io.Reader
retrieveArticleBody(java.lang.String articleId, ArticlePointer pointer)
Deprecated.3.0 useretrieveArticleBody(String, ArticleInfo)
insteadjava.io.Reader
retrieveArticleHeader()
Same asretrieveArticleHeader((String) null)
Note: the return can be cast to aBufferedReader
java.io.Reader
retrieveArticleHeader(int a)
Deprecated.3.0 useretrieveArticleHeader(long)
insteadjava.io.Reader
retrieveArticleHeader(int a, ArticlePointer ap)
Deprecated.3.0 useretrieveArticleHeader(long, ArticleInfo)
insteadjava.io.BufferedReader
retrieveArticleHeader(long articleNumber)
Same asretrieveArticleHeader(articleNumber, null)
java.io.BufferedReader
retrieveArticleHeader(long articleNumber, ArticleInfo pointer)
Retrieves an article header from the currently selected newsgroup.java.io.Reader
retrieveArticleHeader(java.lang.String articleId)
Same asretrieveArticleHeader(articleId, (ArticleInfo) null)
Note: the return can be cast to aBufferedReader
java.io.BufferedReader
retrieveArticleHeader(java.lang.String articleId, ArticleInfo pointer)
Retrieves an article header from the NNTP server.java.io.Reader
retrieveArticleHeader(java.lang.String articleId, ArticlePointer pointer)
Deprecated.3.0 useretrieveArticleHeader(String, ArticleInfo)
insteadjava.io.Reader
retrieveArticleInfo(int lowArticleNumber)
Deprecated.3.0 useretrieveArticleInfo(long)
insteadjava.io.Reader
retrieveArticleInfo(int lowArticleNumber, int highArticleNumber)
Deprecated.3.0 useretrieveArticleInfo(long, long)
insteadjava.io.BufferedReader
retrieveArticleInfo(long articleNumber)
Return article headers for a specified post.java.io.BufferedReader
retrieveArticleInfo(long lowArticleNumber, long highArticleNumber)
Return article headers for all articles between lowArticleNumber and highArticleNumber, inclusively.java.io.Reader
retrieveHeader(java.lang.String a, int b)
Deprecated.3.0 useretrieveHeader(String, long)
insteadjava.io.Reader
retrieveHeader(java.lang.String header, int lowArticleNumber, int highArticleNumber)
Deprecated.3.0 useretrieveHeader(String, long, long)
insteadjava.io.BufferedReader
retrieveHeader(java.lang.String header, long articleNumber)
Return an article header for a specified post.java.io.BufferedReader
retrieveHeader(java.lang.String header, long lowArticleNumber, long highArticleNumber)
Return an article header for all articles between lowArticleNumber and highArticleNumber, inclusively.boolean
selectArticle(int a)
Deprecated.3.0 useselectArticle(long)
insteadboolean
selectArticle(int a, ArticlePointer ap)
Deprecated.3.0 useselectArticle(long, ArticleInfo)
insteadboolean
selectArticle(long articleNumber)
Same asselectArticle(articleNumber, null)
boolean
selectArticle(long articleNumber, ArticleInfo pointer)
Select an article in the currently selected newsgroup by its number.boolean
selectArticle(java.lang.String articleId)
Same asselectArticle(articleId, (ArticleInfo) null)
boolean
selectArticle(java.lang.String articleId, ArticleInfo pointer)
Select an article by its unique identifier (including enclosing < and >) and return its article number and id through the pointer parameter.boolean
selectArticle(java.lang.String articleId, ArticlePointer pointer)
Deprecated.3.0 useselectArticle(String, ArticleInfo)
insteadboolean
selectArticle(ArticleInfo pointer)
Same asselectArticle((String) null, articleId)
.boolean
selectArticle(ArticlePointer pointer)
Deprecated.3.0 useselectArticle(ArticleInfo)
insteadboolean
selectNewsgroup(java.lang.String newsgroup)
Same asselectNewsgroup(newsgroup, null)
boolean
selectNewsgroup(java.lang.String newsgroup, NewsgroupInfo info)
Select the specified newsgroup to be the target of for future article retrieval and posting operations.boolean
selectNextArticle()
Same asselectNextArticle((ArticleInfo) null)
boolean
selectNextArticle(ArticleInfo pointer)
Select the article following the currently selected article in the currently selected newsgroup and return its number and unique id through the pointer parameter.boolean
selectNextArticle(ArticlePointer pointer)
Deprecated.3.0 useselectNextArticle(ArticleInfo)
insteadboolean
selectPreviousArticle()
Same asselectPreviousArticle((ArticleInfo) null)
boolean
selectPreviousArticle(ArticleInfo pointer)
Select the article preceeding the currently selected article in the currently selected newsgroup and return its number and unique id through the pointer parameter.boolean
selectPreviousArticle(ArticlePointer pointer)
Deprecated.3.0 useselectPreviousArticle(ArticleInfo)
instead-
Methods inherited from class org.apache.commons.net.nntp.NNTP
_connectAction_, article, article, article, article, authinfoPass, authinfoUser, body, body, body, body, disconnect, getCommandSupport, getReply, getReplyCode, getReplyString, group, head, head, head, head, help, ihave, isAllowedToPost, last, list, listActive, newgroups, newnews, next, post, quit, sendCommand, sendCommand, sendCommand, sendCommand, stat, stat, stat, stat, xhdr, xover
-
Methods inherited from class org.apache.commons.net.SocketClient
addProtocolCommandListener, connect, connect, connect, connect, connect, connect, createCommandSupport, fireCommandSent, fireReplyReceived, getCharset, getCharsetName, getConnectTimeout, getDefaultPort, getDefaultTimeout, getKeepAlive, getLocalAddress, getLocalPort, getProxy, getReceiveBufferSize, getRemoteAddress, getRemotePort, getSendBufferSize, getServerSocketFactory, getSoLinger, getSoTimeout, getTcpNoDelay, isAvailable, isConnected, removeProtocolCommandListener, setCharset, setConnectTimeout, setDefaultPort, setDefaultTimeout, setKeepAlive, setProxy, setReceiveBufferSize, setSendBufferSize, setServerSocketFactory, setSocketFactory, setSoLinger, setSoTimeout, setTcpNoDelay, verifyRemote
-
-
-
-
Method Detail
-
retrieveArticle
public java.io.BufferedReader retrieveArticle(java.lang.String articleId, ArticleInfo pointer) throws java.io.IOException
Retrieves an article from the NNTP server. The article is referenced by its unique article identifier (including the enclosing < and >). The article number and identifier contained in the server reply are returned through an ArticleInfo. ThearticleId
field of the ArticleInfo cannot always be trusted because some NNTP servers do not correctly follow the RFC 977 reply format.A DotTerminatedMessageReader is returned from which the article can be read. If the article does not exist, null is returned.
You must not issue any commands to the NNTP server (i.e., call any other methods) until you finish reading the message from the returned BufferedReader instance. The NNTP protocol uses the same stream for issuing commands as it does for returning results. Therefore the returned BufferedReader actually reads directly from the NNTP connection. After the end of message has been reached, new commands can be executed and their replies read. If you do not follow these requirements, your program will not work properly.
- Parameters:
articleId
- The unique article identifier of the article to retrieve. If this parameter is null, the currently selected article is retrieved.pointer
- A parameter through which to return the article's number and unique id. The articleId field cannot always be trusted because of server deviations from RFC 977 reply formats. You may set this parameter to null if you do not desire to retrieve the returned article information.- Returns:
- A DotTerminatedMessageReader instance from which the article can be read. null if the article does not exist.
- Throws:
NNTPConnectionClosedException
- If the NNTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send NNTP reply code 400. This exception may be caught either as an IOException or independently as itself.java.io.IOException
- If an I/O error occurs while either sending a command to the server or receiving a reply from the server.
-
retrieveArticle
public java.io.Reader retrieveArticle(java.lang.String articleId) throws java.io.IOException
Same asretrieveArticle(articleId, (ArticleInfo) null)
Note: the return can be cast to aBufferedReader
- Parameters:
articleId
- the article id to retrieve- Returns:
- A DotTerminatedMessageReader instance from which the article can be read. null if the article does not exist.
- Throws:
java.io.IOException
- if an IO error occurs
-
retrieveArticle
public java.io.Reader retrieveArticle() throws java.io.IOException
Same asretrieveArticle((String) null)
Note: the return can be cast to aBufferedReader
- Returns:
- A DotTerminatedMessageReader instance from which the article can be read. null if the article does not exist.
- Throws:
java.io.IOException
- if an IO error occurs
-
retrieveArticle
public java.io.BufferedReader retrieveArticle(long articleNumber, ArticleInfo pointer) throws java.io.IOException
Retrieves an article from the currently selected newsgroup. The article is referenced by its article number. The article number and identifier contained in the server reply are returned through an ArticleInfo. ThearticleId
field of the ArticleInfo cannot always be trusted because some NNTP servers do not correctly follow the RFC 977 reply format.A DotTerminatedMessageReader is returned from which the article can be read. If the article does not exist, null is returned.
You must not issue any commands to the NNTP server (i.e., call any other methods) until you finish reading the message from the returned BufferedReader instance. The NNTP protocol uses the same stream for issuing commands as it does for returning results. Therefore the returned BufferedReader actually reads directly from the NNTP connection. After the end of message has been reached, new commands can be executed and their replies read. If you do not follow these requirements, your program will not work properly.
- Parameters:
articleNumber
- The number of the the article to retrieve.pointer
- A parameter through which to return the article's number and unique id. The articleId field cannot always be trusted because of server deviations from RFC 977 reply formats. You may set this parameter to null if you do not desire to retrieve the returned article information.- Returns:
- A DotTerminatedMessageReader instance from which the article can be read. null if the article does not exist.
- Throws:
NNTPConnectionClosedException
- If the NNTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send NNTP reply code 400. This exception may be caught either as an IOException or independently as itself.java.io.IOException
- If an I/O error occurs while either sending a command to the server or receiving a reply from the server.
-
retrieveArticle
public java.io.BufferedReader retrieveArticle(long articleNumber) throws java.io.IOException
Same asretrieveArticle(articleNumber, null)
- Parameters:
articleNumber
- the article number to fetch- Returns:
- A DotTerminatedMessageReader instance from which the article can be read. null if the article does not exist.
- Throws:
java.io.IOException
- if an IO error occurs
-
retrieveArticleHeader
public java.io.BufferedReader retrieveArticleHeader(java.lang.String articleId, ArticleInfo pointer) throws java.io.IOException
Retrieves an article header from the NNTP server. The article is referenced by its unique article identifier (including the enclosing < and >). The article number and identifier contained in the server reply are returned through an ArticleInfo. ThearticleId
field of the ArticleInfo cannot always be trusted because some NNTP servers do not correctly follow the RFC 977 reply format.A DotTerminatedMessageReader is returned from which the article can be read. If the article does not exist, null is returned.
You must not issue any commands to the NNTP server (i.e., call any other methods) until you finish reading the message from the returned BufferedReader instance. The NNTP protocol uses the same stream for issuing commands as it does for returning results. Therefore the returned BufferedReader actually reads directly from the NNTP connection. After the end of message has been reached, new commands can be executed and their replies read. If you do not follow these requirements, your program will not work properly.
- Parameters:
articleId
- The unique article identifier of the article whose header is being retrieved. If this parameter is null, the header of the currently selected article is retrieved.pointer
- A parameter through which to return the article's number and unique id. The articleId field cannot always be trusted because of server deviations from RFC 977 reply formats. You may set this parameter to null if you do not desire to retrieve the returned article information.- Returns:
- A DotTerminatedMessageReader instance from which the article header can be read. null if the article does not exist.
- Throws:
NNTPConnectionClosedException
- If the NNTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send NNTP reply code 400. This exception may be caught either as an IOException or independently as itself.java.io.IOException
- If an I/O error occurs while either sending a command to the server or receiving a reply from the server.
-
retrieveArticleHeader
public java.io.Reader retrieveArticleHeader(java.lang.String articleId) throws java.io.IOException
Same asretrieveArticleHeader(articleId, (ArticleInfo) null)
Note: the return can be cast to aBufferedReader
- Parameters:
articleId
- the article id to fetch- Returns:
- the reader
- Throws:
java.io.IOException
- if an error occurs
-
retrieveArticleHeader
public java.io.Reader retrieveArticleHeader() throws java.io.IOException
Same asretrieveArticleHeader((String) null)
Note: the return can be cast to aBufferedReader
- Returns:
- the reader
- Throws:
java.io.IOException
- if an error occurs
-
retrieveArticleHeader
public java.io.BufferedReader retrieveArticleHeader(long articleNumber, ArticleInfo pointer) throws java.io.IOException
Retrieves an article header from the currently selected newsgroup. The article is referenced by its article number. The article number and identifier contained in the server reply are returned through an ArticleInfo. ThearticleId
field of the ArticleInfo cannot always be trusted because some NNTP servers do not correctly follow the RFC 977 reply format.A DotTerminatedMessageReader is returned from which the article can be read. If the article does not exist, null is returned.
You must not issue any commands to the NNTP server (i.e., call any other methods) until you finish reading the message from the returned BufferedReader instance. The NNTP protocol uses the same stream for issuing commands as it does for returning results. Therefore the returned BufferedReader actually reads directly from the NNTP connection. After the end of message has been reached, new commands can be executed and their replies read. If you do not follow these requirements, your program will not work properly.
- Parameters:
articleNumber
- The number of the the article whose header is being retrieved.pointer
- A parameter through which to return the article's number and unique id. The articleId field cannot always be trusted because of server deviations from RFC 977 reply formats. You may set this parameter to null if you do not desire to retrieve the returned article information.- Returns:
- A DotTerminatedMessageReader instance from which the article header can be read. null if the article does not exist.
- Throws:
NNTPConnectionClosedException
- If the NNTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send NNTP reply code 400. This exception may be caught either as an IOException or independently as itself.java.io.IOException
- If an I/O error occurs while either sending a command to the server or receiving a reply from the server.
-
retrieveArticleHeader
public java.io.BufferedReader retrieveArticleHeader(long articleNumber) throws java.io.IOException
Same asretrieveArticleHeader(articleNumber, null)
- Parameters:
articleNumber
- the article number- Returns:
- the reader
- Throws:
java.io.IOException
- if an error occurs
-
retrieveArticleBody
public java.io.BufferedReader retrieveArticleBody(java.lang.String articleId, ArticleInfo pointer) throws java.io.IOException
Retrieves an article body from the NNTP server. The article is referenced by its unique article identifier (including the enclosing < and >). The article number and identifier contained in the server reply are returned through an ArticleInfo. ThearticleId
field of the ArticleInfo cannot always be trusted because some NNTP servers do not correctly follow the RFC 977 reply format.A DotTerminatedMessageReader is returned from which the article can be read. If the article does not exist, null is returned.
You must not issue any commands to the NNTP server (i.e., call any other methods) until you finish reading the message from the returned BufferedReader instance. The NNTP protocol uses the same stream for issuing commands as it does for returning results. Therefore the returned BufferedReader actually reads directly from the NNTP connection. After the end of message has been reached, new commands can be executed and their replies read. If you do not follow these requirements, your program will not work properly.
- Parameters:
articleId
- The unique article identifier of the article whose body is being retrieved. If this parameter is null, the body of the currently selected article is retrieved.pointer
- A parameter through which to return the article's number and unique id. The articleId field cannot always be trusted because of server deviations from RFC 977 reply formats. You may set this parameter to null if you do not desire to retrieve the returned article information.- Returns:
- A DotTerminatedMessageReader instance from which the article body can be read. null if the article does not exist.
- Throws:
NNTPConnectionClosedException
- If the NNTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send NNTP reply code 400. This exception may be caught either as an IOException or independently as itself.java.io.IOException
- If an I/O error occurs while either sending a command to the server or receiving a reply from the server.
-
retrieveArticleBody
public java.io.Reader retrieveArticleBody(java.lang.String articleId) throws java.io.IOException
Same asretrieveArticleBody(articleId, (ArticleInfo) null)
Note: the return can be cast to aBufferedReader
- Parameters:
articleId
- the article id- Returns:
- A DotTerminatedMessageReader instance from which the article body can be read. null if the article does not exist.
- Throws:
java.io.IOException
- if an error occurs
-
retrieveArticleBody
public java.io.Reader retrieveArticleBody() throws java.io.IOException
Same asretrieveArticleBody(null)
Note: the return can be cast to aBufferedReader
- Returns:
- A DotTerminatedMessageReader instance from which the article body can be read. null if the article does not exist.
- Throws:
java.io.IOException
- if an error occurs
-
retrieveArticleBody
public java.io.BufferedReader retrieveArticleBody(long articleNumber, ArticleInfo pointer) throws java.io.IOException
Retrieves an article body from the currently selected newsgroup. The article is referenced by its article number. The article number and identifier contained in the server reply are returned through an ArticleInfo. ThearticleId
field of the ArticleInfo cannot always be trusted because some NNTP servers do not correctly follow the RFC 977 reply format.A DotTerminatedMessageReader is returned from which the article can be read. If the article does not exist, null is returned.
You must not issue any commands to the NNTP server (i.e., call any other methods) until you finish reading the message from the returned BufferedReader instance. The NNTP protocol uses the same stream for issuing commands as it does for returning results. Therefore the returned BufferedReader actually reads directly from the NNTP connection. After the end of message has been reached, new commands can be executed and their replies read. If you do not follow these requirements, your program will not work properly.
- Parameters:
articleNumber
- The number of the the article whose body is being retrieved.pointer
- A parameter through which to return the article's number and unique id. The articleId field cannot always be trusted because of server deviations from RFC 977 reply formats. You may set this parameter to null if you do not desire to retrieve the returned article information.- Returns:
- A DotTerminatedMessageReader instance from which the article body can be read. null if the article does not exist.
- Throws:
NNTPConnectionClosedException
- If the NNTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send NNTP reply code 400. This exception may be caught either as an IOException or independently as itself.java.io.IOException
- If an I/O error occurs while either sending a command to the server or receiving a reply from the server.
-
retrieveArticleBody
public java.io.BufferedReader retrieveArticleBody(long articleNumber) throws java.io.IOException
Same asretrieveArticleBody(articleNumber, null)
- Parameters:
articleNumber
- the article number- Returns:
- the reader
- Throws:
java.io.IOException
- if an error occurs
-
selectNewsgroup
public boolean selectNewsgroup(java.lang.String newsgroup, NewsgroupInfo info) throws java.io.IOException
Select the specified newsgroup to be the target of for future article retrieval and posting operations. Also return the newsgroup information contained in the server reply through the info parameter.- Parameters:
newsgroup
- The newsgroup to select.info
- A parameter through which the newsgroup information of the selected newsgroup contained in the server reply is returned. Set this to null if you do not desire this information.- Returns:
- True if the newsgroup exists and was selected, false otherwise.
- Throws:
NNTPConnectionClosedException
- If the NNTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send NNTP reply code 400. This exception may be caught either as an IOException or independently as itself.java.io.IOException
- If an I/O error occurs while either sending a command to the server or receiving a reply from the server.
-
selectNewsgroup
public boolean selectNewsgroup(java.lang.String newsgroup) throws java.io.IOException
Same asselectNewsgroup(newsgroup, null)
- Parameters:
newsgroup
- the newsgroup name- Returns:
- true if newsgroup exist and was selected
- Throws:
java.io.IOException
- if an error occurs
-
listHelp
public java.lang.String listHelp() throws java.io.IOException
List the command help from the server.- Returns:
- The sever help information.
- Throws:
NNTPConnectionClosedException
- If the NNTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send NNTP reply code 400. This exception may be caught either as an IOException or independently as itself.java.io.IOException
- If an I/O error occurs while either sending a command to the server or receiving a reply from the server.
-
listOverviewFmt
public java.lang.String[] listOverviewFmt() throws java.io.IOException
Send a "LIST OVERVIEW.FMT" command to the server.- Returns:
- the contents of the Overview format, of
null
if the command failed - Throws:
java.io.IOException
- on error
-
selectArticle
public boolean selectArticle(java.lang.String articleId, ArticleInfo pointer) throws java.io.IOException
Select an article by its unique identifier (including enclosing < and >) and return its article number and id through the pointer parameter. This is achieved through the STAT command. According to RFC 977, this will NOT set the current article pointer on the server. To do that, you must reference the article by its number.- Parameters:
articleId
- The unique article identifier of the article that is being selectedd. If this parameter is null, the body of the current article is selectedpointer
- A parameter through which to return the article's number and unique id. The articleId field cannot always be trusted because of server deviations from RFC 977 reply formats. You may set this parameter to null if you do not desire to retrieve the returned article information.- Returns:
- True if successful, false if not.
- Throws:
NNTPConnectionClosedException
- If the NNTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send NNTP reply code 400. This exception may be caught either as an IOException or independently as itself.java.io.IOException
- If an I/O error occurs while either sending a command to the server or receiving a reply from the server.
-
selectArticle
public boolean selectArticle(java.lang.String articleId) throws java.io.IOException
Same asselectArticle(articleId, (ArticleInfo) null)
- Parameters:
articleId
- the article Id- Returns:
- true if successful
- Throws:
java.io.IOException
- on error
-
selectArticle
public boolean selectArticle(ArticleInfo pointer) throws java.io.IOException
Same asselectArticle((String) null, articleId)
. Useful for retrieving the current article number.- Parameters:
pointer
- to the article- Returns:
- true if OK
- Throws:
java.io.IOException
- on error
-
selectArticle
public boolean selectArticle(long articleNumber, ArticleInfo pointer) throws java.io.IOException
Select an article in the currently selected newsgroup by its number. and return its article number and id through the pointer parameter. This is achieved through the STAT command. According to RFC 977, this WILL set the current article pointer on the server. Use this command to select an article before retrieving it, or to obtain an article's unique identifier given its number.- Parameters:
articleNumber
- The number of the article to select from the currently selected newsgroup.pointer
- A parameter through which to return the article's number and unique id. Although the articleId field cannot always be trusted because of server deviations from RFC 977 reply formats, we haven't found a server that misformats this information in response to this particular command. You may set this parameter to null if you do not desire to retrieve the returned article information.- Returns:
- True if successful, false if not.
- Throws:
NNTPConnectionClosedException
- If the NNTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send NNTP reply code 400. This exception may be caught either as an IOException or independently as itself.java.io.IOException
- If an I/O error occurs while either sending a command to the server or receiving a reply from the server.
-
selectArticle
public boolean selectArticle(long articleNumber) throws java.io.IOException
Same asselectArticle(articleNumber, null)
- Parameters:
articleNumber
- the numger- Returns:
- true if successful
- Throws:
java.io.IOException
- on error
-
selectPreviousArticle
public boolean selectPreviousArticle(ArticleInfo pointer) throws java.io.IOException
Select the article preceeding the currently selected article in the currently selected newsgroup and return its number and unique id through the pointer parameter. Because of deviating server implementations, the articleId information cannot be trusted. To obtain the article identifier, issue aselectArticle(pointer.articleNumber, pointer)
immediately afterward.- Parameters:
pointer
- A parameter through which to return the article's number and unique id. The articleId field cannot always be trusted because of server deviations from RFC 977 reply formats. You may set this parameter to null if you do not desire to retrieve the returned article information.- Returns:
- True if successful, false if not (e.g., there is no previous article).
- Throws:
NNTPConnectionClosedException
- If the NNTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send NNTP reply code 400. This exception may be caught either as an IOException or independently as itself.java.io.IOException
- If an I/O error occurs while either sending a command to the server or receiving a reply from the server.
-
selectPreviousArticle
public boolean selectPreviousArticle() throws java.io.IOException
Same asselectPreviousArticle((ArticleInfo) null)
- Returns:
- true if successful
- Throws:
java.io.IOException
- on error
-
selectNextArticle
public boolean selectNextArticle(ArticleInfo pointer) throws java.io.IOException
Select the article following the currently selected article in the currently selected newsgroup and return its number and unique id through the pointer parameter. Because of deviating server implementations, the articleId information cannot be trusted. To obtain the article identifier, issue aselectArticle(pointer.articleNumber, pointer)
immediately afterward.- Parameters:
pointer
- A parameter through which to return the article's number and unique id. The articleId field cannot always be trusted because of server deviations from RFC 977 reply formats. You may set this parameter to null if you do not desire to retrieve the returned article information.- Returns:
- True if successful, false if not (e.g., there is no following article).
- Throws:
NNTPConnectionClosedException
- If the NNTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send NNTP reply code 400. This exception may be caught either as an IOException or independently as itself.java.io.IOException
- If an I/O error occurs while either sending a command to the server or receiving a reply from the server.
-
selectNextArticle
public boolean selectNextArticle() throws java.io.IOException
Same asselectNextArticle((ArticleInfo) null)
- Returns:
- true if successful
- Throws:
java.io.IOException
- on error
-
listNewsgroups
public NewsgroupInfo[] listNewsgroups() throws java.io.IOException
List all newsgroups served by the NNTP server. If no newsgroups are served, a zero length array will be returned. If the command fails, null will be returned. The method uses the "LIST" command.- Returns:
- An array of NewsgroupInfo instances containing the information for each newsgroup served by the NNTP server. If no newsgroups are served, a zero length array will be returned. If the command fails, null will be returned.
- Throws:
NNTPConnectionClosedException
- If the NNTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send NNTP reply code 400. This exception may be caught either as an IOException or independently as itself.java.io.IOException
- If an I/O error occurs while either sending a command to the server or receiving a reply from the server.- See Also:
iterateNewsgroupListing()
,iterateNewsgroups()
-
iterateNewsgroupListing
public java.lang.Iterable<java.lang.String> iterateNewsgroupListing() throws java.io.IOException
List all newsgroups served by the NNTP server. If no newsgroups are served, no entries will be returned. The method uses the "LIST" command.- Returns:
- An iterable of NewsgroupInfo instances containing the information for each newsgroup served by the NNTP server. If no newsgroups are served, no entries will be returned.
- Throws:
NNTPConnectionClosedException
- If the NNTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send NNTP reply code 400. This exception may be caught either as an IOException or independently as itself.java.io.IOException
- If an I/O error occurs while either sending a command to the server or receiving a reply from the server.- Since:
- 3.0
-
iterateNewsgroups
public java.lang.Iterable<NewsgroupInfo> iterateNewsgroups() throws java.io.IOException
List all newsgroups served by the NNTP server. If no newsgroups are served, no entries will be returned. The method uses the "LIST" command.- Returns:
- An iterable of Strings containing the raw information for each newsgroup served by the NNTP server. If no newsgroups are served, no entries will be returned.
- Throws:
NNTPConnectionClosedException
- If the NNTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send NNTP reply code 400. This exception may be caught either as an IOException or independently as itself.java.io.IOException
- If an I/O error occurs while either sending a command to the server or receiving a reply from the server.- Since:
- 3.0
-
listNewsgroups
public NewsgroupInfo[] listNewsgroups(java.lang.String wildmat) throws java.io.IOException
List the newsgroups that match a given pattern. Uses the "LIST ACTIVE" command.- Parameters:
wildmat
- a pseudo-regex pattern (cf. RFC 2980)- Returns:
- An array of NewsgroupInfo instances containing the information for each newsgroup served by the NNTP server corresponding to the supplied pattern. If no such newsgroups are served, a zero length array will be returned. If the command fails, null will be returned.
- Throws:
java.io.IOException
- on error- See Also:
iterateNewsgroupListing(String)
,iterateNewsgroups(String)
-
iterateNewsgroupListing
public java.lang.Iterable<java.lang.String> iterateNewsgroupListing(java.lang.String wildmat) throws java.io.IOException
List the newsgroups that match a given pattern. Uses the "LIST ACTIVE" command.- Parameters:
wildmat
- a pseudo-regex pattern (cf. RFC 2980)- Returns:
- An iterable of Strings containing the raw information for each newsgroup served by the NNTP server corresponding to the supplied pattern. If no such newsgroups are served, no entries will be returned.
- Throws:
java.io.IOException
- on error- Since:
- 3.0
-
iterateNewsgroups
public java.lang.Iterable<NewsgroupInfo> iterateNewsgroups(java.lang.String wildmat) throws java.io.IOException
List the newsgroups that match a given pattern. Uses the "LIST ACTIVE" command.- Parameters:
wildmat
- a pseudo-regex pattern (cf. RFC 2980)- Returns:
- An iterable NewsgroupInfo instances containing the information for each newsgroup served by the NNTP server corresponding to the supplied pattern. If no such newsgroups are served, no entries will be returned.
- Throws:
java.io.IOException
- on error- Since:
- 3.0
-
listNewNewsgroups
public NewsgroupInfo[] listNewNewsgroups(NewGroupsOrNewsQuery query) throws java.io.IOException
List all new newsgroups added to the NNTP server since a particular date subject to the conditions of the specified query. If no new newsgroups were added, a zero length array will be returned. If the command fails, null will be returned. This uses the "NEWGROUPS" command.- Parameters:
query
- The query restricting how to search for new newsgroups.- Returns:
- An array of NewsgroupInfo instances containing the information for each new newsgroup added to the NNTP server. If no newsgroups were added, a zero length array will be returned. If the command fails, null will be returned.
- Throws:
NNTPConnectionClosedException
- If the NNTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send NNTP reply code 400. This exception may be caught either as an IOException or independently as itself.java.io.IOException
- If an I/O error occurs while either sending a command to the server or receiving a reply from the server.- See Also:
iterateNewNewsgroups(NewGroupsOrNewsQuery)
,iterateNewNewsgroupListing(NewGroupsOrNewsQuery)
-
iterateNewNewsgroupListing
public java.lang.Iterable<java.lang.String> iterateNewNewsgroupListing(NewGroupsOrNewsQuery query) throws java.io.IOException
List all new newsgroups added to the NNTP server since a particular date subject to the conditions of the specified query. If no new newsgroups were added, no entries will be returned. This uses the "NEWGROUPS" command.- Parameters:
query
- The query restricting how to search for new newsgroups.- Returns:
- An iterable of Strings containing the raw information for each new newsgroup added to the NNTP server. If no newsgroups were added, no entries will be returned.
- Throws:
NNTPConnectionClosedException
- If the NNTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send NNTP reply code 400. This exception may be caught either as an IOException or independently as itself.java.io.IOException
- If an I/O error occurs while either sending a command to the server or receiving a reply from the server.- Since:
- 3.0
-
iterateNewNewsgroups
public java.lang.Iterable<NewsgroupInfo> iterateNewNewsgroups(NewGroupsOrNewsQuery query) throws java.io.IOException
List all new newsgroups added to the NNTP server since a particular date subject to the conditions of the specified query. If no new newsgroups were added, no entries will be returned. This uses the "NEWGROUPS" command.- Parameters:
query
- The query restricting how to search for new newsgroups.- Returns:
- An iterable of NewsgroupInfo instances containing the information for each new newsgroup added to the NNTP server. If no newsgroups were added, no entries will be returned.
- Throws:
NNTPConnectionClosedException
- If the NNTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send NNTP reply code 400. This exception may be caught either as an IOException or independently as itself.java.io.IOException
- If an I/O error occurs while either sending a command to the server or receiving a reply from the server.- Since:
- 3.0
-
listNewNews
public java.lang.String[] listNewNews(NewGroupsOrNewsQuery query) throws java.io.IOException
List all new articles added to the NNTP server since a particular date subject to the conditions of the specified query. If no new new news is found, a zero length array will be returned. If the command fails, null will be returned. You must add at least one newsgroup to the query, else the command will fail. Each String in the returned array is a unique message identifier including the enclosing < and >. This uses the "NEWNEWS" command.- Parameters:
query
- The query restricting how to search for new news. You must add at least one newsgroup to the query.- Returns:
- An array of String instances containing the unique message identifiers for each new article added to the NNTP server. If no new news is found, a zero length array will be returned. If the command fails, null will be returned.
- Throws:
NNTPConnectionClosedException
- If the NNTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send NNTP reply code 400. This exception may be caught either as an IOException or independently as itself.java.io.IOException
- If an I/O error occurs while either sending a command to the server or receiving a reply from the server.- See Also:
iterateNewNews(NewGroupsOrNewsQuery)
-
iterateNewNews
public java.lang.Iterable<java.lang.String> iterateNewNews(NewGroupsOrNewsQuery query) throws java.io.IOException
List all new articles added to the NNTP server since a particular date subject to the conditions of the specified query. If no new new news is found, no entries will be returned. This uses the "NEWNEWS" command. You must add at least one newsgroup to the query, else the command will fail. Each String which is returned is a unique message identifier including the enclosing < and >.- Parameters:
query
- The query restricting how to search for new news. You must add at least one newsgroup to the query.- Returns:
- An iterator of String instances containing the unique message identifiers for each new article added to the NNTP server. If no new news is found, no strings will be returned.
- Throws:
NNTPConnectionClosedException
- If the NNTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send NNTP reply code 400. This exception may be caught either as an IOException or independently as itself.java.io.IOException
- If an I/O error occurs while either sending a command to the server or receiving a reply from the server.- Since:
- 3.0
-
completePendingCommand
public boolean completePendingCommand() throws java.io.IOException
There are a few NNTPClient methods that do not complete the entire sequence of NNTP commands to complete a transaction. These commands require some action by the programmer after the reception of a positive preliminary command. After the programmer's code completes its actions, it must call this method to receive the completion reply from the server and verify the success of the entire transaction.For example
writer = client.postArticle(); if(writer == null) // failure return false; header = new SimpleNNTPHeader("foobar@foo.com", "Just testing"); header.addNewsgroup("alt.test"); writer.write(header.toString()); writer.write("This is just a test"); writer.close(); if(!client.completePendingCommand()) // failure return false;
- Returns:
- True if successfully completed, false if not.
- Throws:
NNTPConnectionClosedException
- If the NNTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send NNTP reply code 400. This exception may be caught either as an IOException or independently as itself.java.io.IOException
- If an I/O error occurs while either sending a command to the server or receiving a reply from the server.
-
postArticle
public java.io.Writer postArticle() throws java.io.IOException
Post an article to the NNTP server. This method returns a DotTerminatedMessageWriter instance to which the article can be written. Null is returned if the posting attempt fails. You should checkisAllowedToPost()
before trying to post. However, a posting attempt can fail due to malformed headers.You must not issue any commands to the NNTP server (i.e., call any (other methods) until you finish writing to the returned Writer instance and close it. The NNTP protocol uses the same stream for issuing commands as it does for returning results. Therefore the returned Writer actually writes directly to the NNTP connection. After you close the writer, you can execute new commands. If you do not follow these requirements your program will not work properly.
Different NNTP servers will require different header formats, but you can use the provided
SimpleNNTPHeader
class to construct the bare minimum acceptable header for most news readers. To construct more complicated headers you should refer to RFC 822. When the Java Mail API is finalized, you will be able to use it to compose fully compliant Internet text messages. The DotTerminatedMessageWriter takes care of doubling line-leading dots and ending the message with a single dot upon closing, so all you have to worry about is writing the header and the message.Upon closing the returned Writer, you need to call
completePendingCommand()
to finalize the posting and verify its success or failure from the server reply.- Returns:
- A DotTerminatedMessageWriter to which the article (including header) can be written. Returns null if the command fails.
- Throws:
java.io.IOException
- If an I/O error occurs while either sending a command to the server or receiving a reply from the server.
-
forwardArticle
public java.io.Writer forwardArticle(java.lang.String articleId) throws java.io.IOException
- Throws:
java.io.IOException
-
logout
public boolean logout() throws java.io.IOException
Logs out of the news server gracefully by sending the QUIT command. However, you must still disconnect from the server before you can open a new connection.- Returns:
- True if successfully completed, false if not.
- Throws:
java.io.IOException
- If an I/O error occurs while either sending a command to the server or receiving a reply from the server.
-
authenticate
public boolean authenticate(java.lang.String username, java.lang.String password) throws java.io.IOException
Log into a news server by sending the AUTHINFO USER/AUTHINFO PASS command sequence. This is usually sent in response to a 480 reply code from the NNTP server.- Parameters:
username
- a valid usernamepassword
- the corresponding password- Returns:
- True for successful login, false for a failure
- Throws:
java.io.IOException
- on error
-
retrieveArticleInfo
public java.io.BufferedReader retrieveArticleInfo(long articleNumber) throws java.io.IOException
Return article headers for a specified post.- Parameters:
articleNumber
- the article to retrieve headers for- Returns:
- a DotTerminatedReader if successful, null otherwise
- Throws:
java.io.IOException
- on error
-
retrieveArticleInfo
public java.io.BufferedReader retrieveArticleInfo(long lowArticleNumber, long highArticleNumber) throws java.io.IOException
Return article headers for all articles between lowArticleNumber and highArticleNumber, inclusively. Uses the XOVER command.- Parameters:
lowArticleNumber
- low numberhighArticleNumber
- high number- Returns:
- a DotTerminatedReader if successful, null otherwise
- Throws:
java.io.IOException
- on error
-
iterateArticleInfo
public java.lang.Iterable<Article> iterateArticleInfo(long lowArticleNumber, long highArticleNumber) throws java.io.IOException
Return article headers for all articles between lowArticleNumber and highArticleNumber, inclusively, using the XOVER command.- Parameters:
lowArticleNumber
- lowhighArticleNumber
- high- Returns:
- an Iterable of Articles
- Throws:
java.io.IOException
- if the command failed- Since:
- 3.0
-
retrieveHeader
public java.io.BufferedReader retrieveHeader(java.lang.String header, long articleNumber) throws java.io.IOException
Return an article header for a specified post.- Parameters:
header
- the header to retrievearticleNumber
- the article to retrieve the header for- Returns:
- a DotTerminatedReader if successful, null otherwise
- Throws:
java.io.IOException
- on error
-
retrieveHeader
public java.io.BufferedReader retrieveHeader(java.lang.String header, long lowArticleNumber, long highArticleNumber) throws java.io.IOException
Return an article header for all articles between lowArticleNumber and highArticleNumber, inclusively.- Parameters:
header
- the headerlowArticleNumber
- to fetchhighArticleNumber
- to fetch- Returns:
- a DotTerminatedReader if successful, null otherwise
- Throws:
java.io.IOException
- on error
-
retrieveHeader
@Deprecated public java.io.Reader retrieveHeader(java.lang.String header, int lowArticleNumber, int highArticleNumber) throws java.io.IOException
Deprecated.3.0 useretrieveHeader(String, long, long)
instead- Parameters:
header
- the headerlowArticleNumber
- to fetchhighArticleNumber
- to fetch- Returns:
- a DotTerminatedReader if successful, null otherwise
- Throws:
java.io.IOException
- on error
-
retrieveArticleInfo
@Deprecated public java.io.Reader retrieveArticleInfo(int lowArticleNumber, int highArticleNumber) throws java.io.IOException
Deprecated.3.0 useretrieveArticleInfo(long, long)
instead- Parameters:
lowArticleNumber
- to fetchhighArticleNumber
- to fetch- Returns:
- a DotTerminatedReader if successful, null otherwise
- Throws:
java.io.IOException
- on error
-
retrieveHeader
@Deprecated public java.io.Reader retrieveHeader(java.lang.String a, int b) throws java.io.IOException
Deprecated.3.0 useretrieveHeader(String, long)
instead- Parameters:
a
- tbab
- tba- Returns:
- tba
- Throws:
java.io.IOException
- tba
-
selectArticle
@Deprecated public boolean selectArticle(int a, ArticlePointer ap) throws java.io.IOException
Deprecated.3.0 useselectArticle(long, ArticleInfo)
instead- Parameters:
a
- tbaap
- tba- Returns:
- tba
- Throws:
java.io.IOException
- tba
-
retrieveArticleInfo
@Deprecated public java.io.Reader retrieveArticleInfo(int lowArticleNumber) throws java.io.IOException
Deprecated.3.0 useretrieveArticleInfo(long)
instead- Parameters:
lowArticleNumber
- to fetch- Returns:
- a DotTerminatedReader if successful, null otherwise
- Throws:
java.io.IOException
- tba
-
selectArticle
@Deprecated public boolean selectArticle(int a) throws java.io.IOException
Deprecated.3.0 useselectArticle(long)
instead- Parameters:
a
- tba- Returns:
- tba
- Throws:
java.io.IOException
- tba
-
retrieveArticleHeader
@Deprecated public java.io.Reader retrieveArticleHeader(int a) throws java.io.IOException
Deprecated.3.0 useretrieveArticleHeader(long)
instead- Parameters:
a
- tba- Returns:
- tba
- Throws:
java.io.IOException
- tba
-
retrieveArticleHeader
@Deprecated public java.io.Reader retrieveArticleHeader(int a, ArticlePointer ap) throws java.io.IOException
Deprecated.3.0 useretrieveArticleHeader(long, ArticleInfo)
instead- Parameters:
a
- tbaap
- tba- Returns:
- tba
- Throws:
java.io.IOException
- tba
-
retrieveArticleBody
@Deprecated public java.io.Reader retrieveArticleBody(int a) throws java.io.IOException
Deprecated.3.0 useretrieveArticleBody(long)
instead- Parameters:
a
- tba- Returns:
- tba
- Throws:
java.io.IOException
- tba
-
retrieveArticle
@Deprecated public java.io.Reader retrieveArticle(int articleNumber, ArticlePointer pointer) throws java.io.IOException
Deprecated.3.0 useretrieveArticle(long, ArticleInfo)
instead- Parameters:
articleNumber
- The number of the the article to retrieve.pointer
- A parameter through which to return the article's number and unique id- Returns:
- A DotTerminatedMessageReader instance from which the article can be read. null if the article does not exist.
- Throws:
java.io.IOException
- on error
-
retrieveArticle
@Deprecated public java.io.Reader retrieveArticle(int articleNumber) throws java.io.IOException
Deprecated.3.0 useretrieveArticle(long)
instead- Parameters:
articleNumber
- The number of the the article to retrieve- Returns:
- A DotTerminatedMessageReader instance from which the article can be read. null if the article does not exist.
- Throws:
java.io.IOException
- on error
-
retrieveArticleBody
@Deprecated public java.io.Reader retrieveArticleBody(int a, ArticlePointer ap) throws java.io.IOException
Deprecated.3.0 useretrieveArticleBody(long, ArticleInfo)
instead- Parameters:
a
- tbaap
- tba- Returns:
- tba
- Throws:
java.io.IOException
- tba
-
retrieveArticle
@Deprecated public java.io.Reader retrieveArticle(java.lang.String articleId, ArticlePointer pointer) throws java.io.IOException
Deprecated.3.0 useretrieveArticle(String, ArticleInfo)
instead- Parameters:
articleId
- The unique article identifier of the article to retrievepointer
- A parameter through which to return the article's number and unique id- Returns:
- A DotTerminatedMessageReader instance from which the article can be read. null if the article does not exist.
- Throws:
java.io.IOException
- on error
-
retrieveArticleBody
@Deprecated public java.io.Reader retrieveArticleBody(java.lang.String articleId, ArticlePointer pointer) throws java.io.IOException
Deprecated.3.0 useretrieveArticleBody(String, ArticleInfo)
instead- Parameters:
articleId
- The unique article identifier of the article to retrievepointer
- A parameter through which to return the article's number and unique id- Returns:
- A DotTerminatedMessageReader instance from which the article body can be read. null if the article does not exist.
- Throws:
java.io.IOException
- on error
-
retrieveArticleHeader
@Deprecated public java.io.Reader retrieveArticleHeader(java.lang.String articleId, ArticlePointer pointer) throws java.io.IOException
Deprecated.3.0 useretrieveArticleHeader(String, ArticleInfo)
instead- Parameters:
articleId
- The unique article identifier of the article to retrievepointer
- A parameter through which to return the article's number and unique id- Returns:
- A DotTerminatedMessageReader instance from which the article body can be read. null if the article does not exist.
- Throws:
java.io.IOException
- on error
-
selectArticle
@Deprecated public boolean selectArticle(java.lang.String articleId, ArticlePointer pointer) throws java.io.IOException
Deprecated.3.0 useselectArticle(String, ArticleInfo)
instead- Parameters:
articleId
- The unique article identifier of the article to retrievepointer
- A parameter through which to return the article's number and unique id- Returns:
- A DotTerminatedMessageReader instance from which the article body can be read. null if the article does not exist.
- Throws:
java.io.IOException
- on error
-
selectArticle
@Deprecated public boolean selectArticle(ArticlePointer pointer) throws java.io.IOException
Deprecated.3.0 useselectArticle(ArticleInfo)
instead- Parameters:
pointer
- A parameter through which to return the article's number and unique id- Returns:
- True if successful, false if not.
- Throws:
java.io.IOException
- on error
-
selectNextArticle
@Deprecated public boolean selectNextArticle(ArticlePointer pointer) throws java.io.IOException
Deprecated.3.0 useselectNextArticle(ArticleInfo)
instead- Parameters:
pointer
- A parameter through which to return the article's number and unique id- Returns:
- True if successful, false if not.
- Throws:
java.io.IOException
- on error
-
selectPreviousArticle
@Deprecated public boolean selectPreviousArticle(ArticlePointer pointer) throws java.io.IOException
Deprecated.3.0 useselectPreviousArticle(ArticleInfo)
instead- Parameters:
pointer
- A parameter through which to return the article's number and unique id- Returns:
- True if successful, false if not.
- Throws:
java.io.IOException
- on error
-
-