nntpclient.java

来自「apache推出的net包」· Java 代码 · 共 1,285 行 · 第 1/4 页

JAVA
1,285
字号
     * Reader instance.     * The NNTP protocol uses the same stream for issuing commands as it does     * for returning results.  Therefore the returned Reader 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 to     *     retrieve.  If this parameter is null, 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     *         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.     ***/    public Reader retrieveArticle(String articleId, ArticlePointer pointer)    throws IOException    {        return __retrieve(NNTPCommand.ARTICLE, articleId, pointer);    }    /*** Same as <code> retrieveArticle(articleId, null) </code> ***/    public Reader retrieveArticle(String articleId) throws IOException    {        return retrieveArticle(articleId, null);    }    /*** Same as <code> retrieveArticle(null) </code> ***/    public Reader retrieveArticle() throws IOException    {        return retrieveArticle(null);    }    /***     * 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 ArticlePointer.  The <code> articleId </code>     * field of the ArticlePointer 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     * Reader instance.     * The NNTP protocol uses the same stream for issuing commands as it does     * for returning results.  Therefore the returned Reader 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 to     *     retrieve.     * @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     *         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.     ***/    public Reader retrieveArticle(int articleNumber, ArticlePointer pointer)    throws IOException    {        return __retrieve(NNTPCommand.ARTICLE, articleNumber, pointer);    }    /*** Same as <code> retrieveArticle(articleNumber, null) </code> ***/    public Reader retrieveArticle(int articleNumber) throws IOException    {        return retrieveArticle(articleNumber, null);    }    /***     * Retrieves an article header from the NNTP server.  The article is     * referenced     * by its unique article identifier (including the enclosing &lt and &gt).     * The article number and identifier contained in the server reply     * are returned through an ArticlePointer.  The <code> articleId </code>     * field of the ArticlePointer 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     * Reader instance.     * The NNTP protocol uses the same stream for issuing commands as it does     * for returning results.  Therefore the returned Reader 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     *    header is being retrieved.  If this parameter is null, the     *    header 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     *         header 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.     ***/    public Reader retrieveArticleHeader(String articleId, ArticlePointer pointer)    throws IOException    {        return __retrieve(NNTPCommand.HEAD, articleId, pointer);    }    /*** Same as <code> retrieveArticleHeader(articleId, null) </code> ***/    public Reader retrieveArticleHeader(String articleId) throws IOException    {        return retrieveArticleHeader(articleId, null);    }    /*** Same as <code> retrieveArticleHeader(null) </code> ***/    public Reader retrieveArticleHeader() throws IOException    {        return retrieveArticleHeader(null);    }    /***     * 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 ArticlePointer.  The <code> articleId </code>     * field of the ArticlePointer 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     * Reader instance.     * The NNTP protocol uses the same stream for issuing commands as it does     * for returning results.  Therefore the returned Reader 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 header 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     *         header 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.     ***/    public Reader retrieveArticleHeader(int articleNumber,                                        ArticlePointer pointer)    throws IOException    {        return __retrieve(NNTPCommand.HEAD, articleNumber, pointer);    }    /*** Same as <code> retrieveArticleHeader(articleNumber, null) </code> ***/    public Reader retrieveArticleHeader(int articleNumber) throws IOException    {        return retrieveArticleHeader(articleNumber, null);    }    /***     * Retrieves an article body from the NNTP server.  The article is     * referenced     * by its unique article identifier (including the enclosing &lt and &gt).     * The article number and identifier contained in the server reply     * are returned through an ArticlePointer.  The <code> articleId </code>     * field of the ArticlePointer 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     * Reader instance.     * The NNTP protocol uses the same stream for issuing commands as it does     * for returning results.  Therefore the returned Reader 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.     ***/    public Reader retrieveArticleBody(String articleId, ArticlePointer pointer)    throws IOException    {        return __retrieve(NNTPCommand.BODY, articleId, pointer);    }    /*** Same as <code> retrieveArticleBody(articleId, null) </code> ***/    public Reader retrieveArticleBody(String articleId) throws IOException    {        return retrieveArticleBody(articleId, null);    }    /*** Same as <code> retrieveArticleBody(null) </code> ***/    public Reader retrieveArticleBody() throws IOException    {        return retrieveArticleBody(null);    }    /***     * 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 ArticlePointer.  The <code> articleId </code>     * field of the ArticlePointer 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     * Reader instance.     * The NNTP protocol uses the same stream for issuing commands as it does     * for returning results.  Therefore the returned Reader 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.     ***/    public Reader retrieveArticleBody(int articleNumber,                                      ArticlePointer pointer)    throws IOException    {        return __retrieve(NNTPCommand.BODY, articleNumber, pointer);    }    /*** Same as <code> retrieveArticleBody(articleNumber, null) </code> ***/    public Reader retrieveArticleBody(int articleNumber) throws IOException    {        return retrieveArticleBody(articleNumber, null);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?