List of usage examples for org.apache.commons.net.nntp NNTPCommand BODY
int BODY
To view the source code for org.apache.commons.net.nntp NNTPCommand BODY.
Click Source Link
From source file:net.longfalcon.newsj.nntp.client.CustomNNTPClient.java
/*** * Retrieves an article body from the NNTP server. The article is * referenced/*from w ww. j a v a 2 s. c o m*/ * by its unique article identifier (including the enclosing < and >). * The article number and identifier contained in the server reply * are returned through an ArticleInfo. The <code> articleId </code> * field of the ArticleInfo cannot always be trusted because some * NNTP servers do not correctly follow the RFC 977 reply format. * <p> * A DotTerminatedMessageReader is returned from which the article can * be read. If the article does not exist, null is returned. * <p> * 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. * <p> * @param 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. * @param 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. * @return A DotTerminatedMessageReader instance from which the article * body can be read. null if the article does not exist. * @exception 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. * @exception IOException If an I/O error occurs while either sending a * command to the server or receiving a reply from the server. ***/ @Override public BufferedReader retrieveArticleBody(String articleId, ArticleInfo pointer) throws IOException { return __retrieve(NNTPCommand.BODY, articleId, pointer); }
From source file:net.longfalcon.newsj.nntp.client.CustomNNTPClient.java
/*** * 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. The <code> articleId </code> * field of the ArticleInfo cannot always be trusted because some * NNTP servers do not correctly follow the RFC 977 reply format. * <p>//www.j a v a 2 s .c om * A DotTerminatedMessageReader is returned from which the article can * be read. If the article does not exist, null is returned. * <p> * 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. * <p> * @param articleNumber The number of the the article whose body is * being retrieved. * @param 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. * @return A DotTerminatedMessageReader instance from which the article * body can be read. null if the article does not exist. * @exception 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. * @exception IOException If an I/O error occurs while either sending a * command to the server or receiving a reply from the server. ***/ @Override public BufferedReader retrieveArticleBody(long articleNumber, ArticleInfo pointer) throws IOException { return __retrieve(NNTPCommand.BODY, articleNumber, pointer); }