nntp.java

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

JAVA
1,018
字号
     * @return The integer value of the NNTP reply code returned by the server     *         in response to the command.     *         in response to the command.     * @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 the     *      command or receiving the server reply.     ***/    public int sendCommand(int command) throws IOException    {        return sendCommand(command, null);    }    /***     * Returns the integer value of the reply code of the last NNTP reply.     * You will usually only use this method after you connect to the     * NNTP server to check that the connection was successful since     * <code> connect </code> is of type void.     * <p>     * @return The integer value of the reply code of the last NNTP reply.     ***/    public int getReplyCode()    {        return _replyCode;    }    /***     * Fetches a reply from the NNTP server and returns the integer reply     * code.  After calling this method, the actual reply text can be accessed     * from {@link #getReplyString  getReplyString }.  Only use this     * method if you are implementing your own NNTP client or if you need to     * fetch a secondary response from the NNTP server.     * <p>     * @return The integer value of the reply code of the fetched NNTP reply.     *         in response to the command.     * @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     *      receiving the server reply.     ***/    public int getReply() throws IOException    {        __getReply();        return _replyCode;    }    /***     * Returns the entire text of the last NNTP server response exactly     * as it was received, not including the end of line marker.     * <p>     * @return The entire text from the last NNTP response as a String.     ***/    public String getReplyString()    {        return _replyString;    }    /***     * A convenience method to send the NNTP ARTICLE command to the server,     * receive the initial reply, and return the reply code.     * <p>     * @param messageId  The message identifier of the requested article,     *                   including the encapsulating &lt and &gt characters.     * @return The reply code received from the server.     * @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 the     *      command or receiving the server reply.     ***/    public int article(String messageId) throws IOException    {        return sendCommand(NNTPCommand.ARTICLE, messageId);    }    /***     * A convenience method to send the NNTP ARTICLE command to the server,     * receive the initial reply, and return the reply code.     * <p>     * @param articleNumber The number of the article to request from the     *                      currently selected newsgroup.     * @return The reply code received from the server.     * @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 the     *      command or receiving the server reply.     ***/    public int article(int articleNumber) throws IOException    {        return sendCommand(NNTPCommand.ARTICLE, Integer.toString(articleNumber));    }    /***     * A convenience method to send the NNTP ARTICLE command to the server,     * receive the initial reply, and return the reply code.     * <p>     * @return The reply code received from the server.     * @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 the     *      command or receiving the server reply.     ***/    public int article() throws IOException    {        return sendCommand(NNTPCommand.ARTICLE);    }    /***     * A convenience method to send the NNTP BODY command to the server,     * receive the initial reply, and return the reply code.     * <p>     * @param messageId  The message identifier of the requested article,     *                   including the encapsulating &lt and &gt characters.     * @return The reply code received from the server.     * @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 the     *      command or receiving the server reply.     ***/    public int body(String messageId) throws IOException    {        return sendCommand(NNTPCommand.BODY, messageId);    }    /***     * A convenience method to send the NNTP BODY command to the server,     * receive the initial reply, and return the reply code.     * <p>     * @param articleNumber The number of the article to request from the     *                      currently selected newsgroup.     * @return The reply code received from the server.     * @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 the     *      command or receiving the server reply.     ***/    public int body(int articleNumber) throws IOException    {        return sendCommand(NNTPCommand.BODY, Integer.toString(articleNumber));    }    /***     * A convenience method to send the NNTP BODY command to the server,     * receive the initial reply, and return the reply code.     * <p>     * @return The reply code received from the server.     * @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 the     *      command or receiving the server reply.     ***/    public int body() throws IOException    {        return sendCommand(NNTPCommand.BODY);    }    /***     * A convenience method to send the NNTP HEAD command to the server,     * receive the initial reply, and return the reply code.     * <p>     * @param messageId  The message identifier of the requested article,     *                   including the encapsulating &lt and &gt characters.     * @return The reply code received from the server.     * @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 the     *      command or receiving the server reply.     ***/    public int head(String messageId) throws IOException    {        return sendCommand(NNTPCommand.HEAD, messageId);    }    /***     * A convenience method to send the NNTP HEAD command to the server,     * receive the initial reply, and return the reply code.     * <p>     * @param articleNumber The number of the article to request from the     *                      currently selected newsgroup.     * @return The reply code received from the server.     * @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 the     *      command or receiving the server reply.     ***/    public int head(int articleNumber) throws IOException    {        return sendCommand(NNTPCommand.HEAD, Integer.toString(articleNumber));    }    /***     * A convenience method to send the NNTP HEAD command to the server,     * receive the initial reply, and return the reply code.     * <p>     * @return The reply code received from the server.     * @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 the     *      command or receiving the server reply.     ***/    public int head() throws IOException    {        return sendCommand(NNTPCommand.HEAD);    }    /***     * A convenience method to send the NNTP STAT command to the server,     * receive the initial reply, and return the reply code.     * <p>     * @param messageId  The message identifier of the requested article,     *                   including the encapsulating &lt and &gt characters.     * @return The reply code received from the server.     * @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 the     *      command or receiving the server reply.     ***/    public int stat(String messageId) throws IOException    {        return sendCommand(NNTPCommand.STAT, messageId);    }    /***     * A convenience method to send the NNTP STAT command to the server,     * receive the initial reply, and return the reply code.     * <p>     * @param articleNumber The number of the article to request from the     *                      currently selected newsgroup.     * @return The reply code received from the server.     * @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 the     *      command or receiving the server reply.     ***/    public int stat(int articleNumber) throws IOException    {        return sendCommand(NNTPCommand.STAT, Integer.toString(articleNumber));    }    /***     * A convenience method to send the NNTP STAT command to the server,     * receive the initial reply, and return the reply code.     * <p>     * @return The reply code received from the server.     * @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 the     *      command or receiving the server reply.     ***/    public int stat() throws IOException    {        return sendCommand(NNTPCommand.STAT);    }    /***     * A convenience method to send the NNTP GROUP command to the server,     * receive the reply, and return the reply code.     * <p>     * @param newsgroup  The name of the newsgroup to select.     * @return The reply code received from the server.     * @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 the     *      command or receiving the server reply.     ***/    public int group(String newsgroup) throws IOException    {        return sendCommand(NNTPCommand.GROUP, newsgroup);    }    /***     * A convenience method to send the NNTP HELP command to the server,     * receive the reply, and return the reply code.     * <p>     * @return The reply code received from the server.     * @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 the     *      command or receiving the server reply.     ***/    public int help() throws IOException    {

⌨️ 快捷键说明

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