org.apache.commons.net.ftp.FTPReply.isPositiveIntermediate()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(10.1k)|赞(0)|评价(0)|浏览(129)

本文整理了Java中org.apache.commons.net.ftp.FTPReply.isPositiveIntermediate()方法的一些代码示例,展示了FTPReply.isPositiveIntermediate()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FTPReply.isPositiveIntermediate()方法的具体详情如下:
包路径:org.apache.commons.net.ftp.FTPReply
类名称:FTPReply
方法名:isPositiveIntermediate

FTPReply.isPositiveIntermediate介绍

[英]Determine if a reply code is a positive intermediate response. All codes beginning with a 3 are positive intermediate responses. The FTP server will send a positive intermediate response on the successful completion of one part of a multi-part sequence of commands. For example, after a successful USER command, a positive intermediate response will be sent to indicate that the server is ready for the PASS command.
[中]确定回复代码是否为肯定的中间响应。所有以3开头的代码都是肯定的中间响应。成功完成多部分命令序列的一部分后,FTP服务器将发送肯定的中间响应。例如,成功执行用户命令后,将发送肯定的中间响应,以指示服务器已准备好执行PASS命令。

代码示例

代码示例来源:origin: commons-net/commons-net

/**
 * Restart a <code>STREAM_TRANSFER_MODE</code> file transfer starting
 * from the given offset.  This will only work on FTP servers supporting
 * the REST comand for the stream transfer mode.  However, most FTP
 * servers support this.  Any subsequent file transfer will start
 * reading or writing the remote file from the indicated offset.
 *
 * @param offset  The offset into the remote file at which to start the
 *           next file transfer.
 * @return True if successfully completed, false if not.
 * @throws FTPConnectionClosedException
 *      If the FTP server prematurely closes the connection as a result
 *      of the client being idle or some other reason causing the server
 *      to send FTP reply code 421.  This exception may be caught either
 *      as an IOException or independently as itself.
 * @throws IOException  If an I/O error occurs while either sending a
 *      command to the server or receiving a reply from the server.
 * @since 3.1 (changed from private to protected)
 */
protected boolean restart(long offset) throws IOException
{
  __restartOffset = 0;
  return FTPReply.isPositiveIntermediate(rest(Long.toString(offset)));
}

代码示例来源:origin: commons-net/commons-net

/**
 * Renames a remote file.
 *
 * @param from  The name of the remote file to rename.
 * @param to    The new name of the remote file.
 * @return True if successfully completed, false if not.
 * @throws FTPConnectionClosedException
 *      If the FTP server prematurely closes the connection as a result
 *      of the client being idle or some other reason causing the server
 *      to send FTP reply code 421.  This exception may be caught either
 *      as an IOException or independently as itself.
 * @throws IOException  If an I/O error occurs while either sending a
 *      command to the server or receiving a reply from the server.
 */
public boolean rename(String from, String to) throws IOException
{
  if (!FTPReply.isPositiveIntermediate(rnfr(from))) {
    return false;
  }
  return FTPReply.isPositiveCompletion(rnto(to));
}

代码示例来源:origin: commons-net/commons-net

if (!FTPReply.isPositiveIntermediate(_replyCode)) {
  return false;
if (!FTPReply.isPositiveIntermediate(_replyCode)) {
  return false;

代码示例来源:origin: commons-net/commons-net

/**
 * Login to the FTP server using the provided username and password.
 *
 * @param username The username to login under.
 * @param password The password to use.
 * @return True if successfully completed, false if not.
 * @throws FTPConnectionClosedException
 *      If the FTP server prematurely closes the connection as a result
 *      of the client being idle or some other reason causing the server
 *      to send FTP reply code 421.  This exception may be caught either
 *      as an IOException or independently as itself.
 * @throws IOException  If an I/O error occurs while either sending a
 *      command to the server or receiving a reply from the server.
 */
public boolean login(String username, String password) throws IOException
{
  user(username);
  if (FTPReply.isPositiveCompletion(_replyCode)) {
    return true;
  }
  // If we get here, we either have an error code, or an intermmediate
  // reply requesting password.
  if (!FTPReply.isPositiveIntermediate(_replyCode)) {
    return false;
  }
  return FTPReply.isPositiveCompletion(pass(password));
}

代码示例来源:origin: org.apache.commons/com.springsource.org.apache.commons.net

/***
 * Restart a <code>STREAM_TRANSFER_MODE</code> file transfer starting
 * from the given offset.  This will only work on FTP servers supporting
 * the REST comand for the stream transfer mode.  However, most FTP
 * servers support this.  Any subsequent file transfer will start
 * reading or writing the remote file from the indicated offset.
 * <p>
 * @param offset  The offset into the remote file at which to start the
 *           next file transfer.
 * @return True if successfully completed, false if not.
 * @exception FTPConnectionClosedException
 *      If the FTP server prematurely closes the connection as a result
 *      of the client being idle or some other reason causing the server
 *      to send FTP reply code 421.  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.
 ***/
private boolean restart(long offset) throws IOException
{
  __restartOffset = 0;
  return FTPReply.isPositiveIntermediate(rest(Long.toString(offset)));
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-net

/***
 * Restart a <code>STREAM_TRANSFER_MODE</code> file transfer starting
 * from the given offset.  This will only work on FTP servers supporting
 * the REST comand for the stream transfer mode.  However, most FTP
 * servers support this.  Any subsequent file transfer will start
 * reading or writing the remote file from the indicated offset.
 * <p>
 * @param offset  The offset into the remote file at which to start the
 *           next file transfer.
 * @return True if successfully completed, false if not.
 * @exception FTPConnectionClosedException
 *      If the FTP server prematurely closes the connection as a result
 *      of the client being idle or some other reason causing the server
 *      to send FTP reply code 421.  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.
 ***/
private boolean restart(long offset) throws IOException
{
  __restartOffset = 0;
  return FTPReply.isPositiveIntermediate(rest(Long.toString(offset)));
}

代码示例来源:origin: org.apache.commons/com.springsource.org.apache.commons.net

/***
 * Renames a remote file.
 * <p>
 * @param from  The name of the remote file to rename.
 * @param to    The new name of the remote file.
 * @return True if successfully completed, false if not.
 * @exception FTPConnectionClosedException
 *      If the FTP server prematurely closes the connection as a result
 *      of the client being idle or some other reason causing the server
 *      to send FTP reply code 421.  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 boolean rename(String from, String to) throws IOException
{
  if (!FTPReply.isPositiveIntermediate(rnfr(from)))
    return false;
  return FTPReply.isPositiveCompletion(rnto(to));
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-net

/***
 * Renames a remote file.
 * <p>
 * @param from  The name of the remote file to rename.
 * @param to    The new name of the remote file.
 * @return True if successfully completed, false if not.
 * @exception FTPConnectionClosedException
 *      If the FTP server prematurely closes the connection as a result
 *      of the client being idle or some other reason causing the server
 *      to send FTP reply code 421.  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 boolean rename(String from, String to) throws IOException
{
  if (!FTPReply.isPositiveIntermediate(rnfr(from)))
    return false;
  return FTPReply.isPositiveCompletion(rnto(to));
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-net

if (!FTPReply.isPositiveIntermediate(_replyCode))
  return false;
  return true;
if (!FTPReply.isPositiveIntermediate(_replyCode))
  return false;

代码示例来源:origin: org.apache.commons/com.springsource.org.apache.commons.net

if (!FTPReply.isPositiveIntermediate(_replyCode))
  return false;
  return true;
if (!FTPReply.isPositiveIntermediate(_replyCode))
  return false;

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-net

/***
 * Login to the FTP server using the provided username and password.
 * <p>
 * @param username The username to login under.
 * @param password The password to use.
 * @return True if successfully completed, false if not.
 * @exception FTPConnectionClosedException
 *      If the FTP server prematurely closes the connection as a result
 *      of the client being idle or some other reason causing the server
 *      to send FTP reply code 421.  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 boolean login(String username, String password) throws IOException
{
  user(username);
  if (FTPReply.isPositiveCompletion(_replyCode))
    return true;
  // If we get here, we either have an error code, or an intermmediate
  // reply requesting password.
  if (!FTPReply.isPositiveIntermediate(_replyCode))
    return false;
  return FTPReply.isPositiveCompletion(pass(password));
}

代码示例来源:origin: org.apache.commons/com.springsource.org.apache.commons.net

/***
 * Login to the FTP server using the provided username and password.
 * <p>
 * @param username The username to login under.
 * @param password The password to use.
 * @return True if successfully completed, false if not.
 * @exception FTPConnectionClosedException
 *      If the FTP server prematurely closes the connection as a result
 *      of the client being idle or some other reason causing the server
 *      to send FTP reply code 421.  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 boolean login(String username, String password) throws IOException
{
  user(username);
  if (FTPReply.isPositiveCompletion(_replyCode))
    return true;
  // If we get here, we either have an error code, or an intermmediate
  // reply requesting password.
  if (!FTPReply.isPositiveIntermediate(_replyCode))
    return false;
  return FTPReply.isPositiveCompletion(pass(password));
}

代码示例来源:origin: approvals/ApprovalTests.Java

/***********************************************************************/
private static void assertValidReplyCode(int code, FTPClient ftp)
{
 if (FTPReply.isPositiveCompletion(code))
 {
  //good
  SimpleLogger.variable("Good Completion code " + code);
 }
 else if (FTPReply.isPositiveIntermediate(code))
 {
  // do nothing
  SimpleLogger.variable("Good Intermediate code " + code);
 }
 else if (FTPReply.isPositivePreliminary(code))
 {
  // do nothing
  SimpleLogger.variable("Good Preliminary code " + code);
 }
 else
 {
  // bad
  throw new Error("Problem encountered with FTP Server, returned Code " + code + ", replied '"
    + ftp.getReplyString() + "'");
 }
}
/***********************************************************************/

相关文章