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

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

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

FTPReply.isPositivePreliminary介绍

[英]Determine if a reply code is a positive preliminary response. All codes beginning with a 1 are positive preliminary responses. Postitive preliminary responses are used to indicate tentative success. No further commands can be issued to the FTP server after a positive preliminary response until a follow up response is received from the server.
[中]确定回复代码是否为肯定的初步响应。所有以1开头的代码都是肯定的初步响应。积极的初步回答用来表示暂时的成功。在收到服务器的后续响应之前,在获得肯定的初步响应后,无法向FTP服务器发出进一步的命令。

代码示例

代码示例来源:origin: org.apache.hadoop/hadoop-common

FSDataInputStream fis = new FSDataInputStream(new FTPInputStream(is,
  client, statistics));
if (!FTPReply.isPositivePreliminary(client.getReplyCode())) {

代码示例来源:origin: org.apache.hadoop/hadoop-common

if (!FTPReply.isPositivePreliminary(client.getReplyCode())) {

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

/**
 * Initiate a server to server file transfer.  This method tells the
 * server to which the client is connected to retrieve a given file from
 * the other server.
 *
 * @param filename  The name of the file to retrieve.
 * @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 remoteRetrieve(String filename) throws IOException
{
  if (__dataConnectionMode == ACTIVE_REMOTE_DATA_CONNECTION_MODE ||
      __dataConnectionMode == PASSIVE_REMOTE_DATA_CONNECTION_MODE) {
    return FTPReply.isPositivePreliminary(retr(filename));
  }
  return false;
}

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

/**
 * Initiate a server to server file transfer.  This method tells the
 * server to which the client is connected to store a file on
 * the other server using a unique filename based on the given filename.
 * The other server must have had a <code> remoteRetrieve </code> issued
 * to it by another FTPClient.
 *
 * @param filename  The name on which to base the filename of the file
 *                  that is to be stored.
 * @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 remoteStoreUnique(String filename) throws IOException
{
  if (__dataConnectionMode == ACTIVE_REMOTE_DATA_CONNECTION_MODE ||
      __dataConnectionMode == PASSIVE_REMOTE_DATA_CONNECTION_MODE) {
    return FTPReply.isPositivePreliminary(stou(filename));
  }
  return false;
}

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

/**
 * Initiate a server to server file transfer.  This method tells the
 * server to which the client is connected to store a file on
 * the other server using the given filename.  The other server must
 * have had a <code> remoteRetrieve </code> issued to it by another
 * FTPClient.
 *
 * @param filename  The name to call the file that is to be stored.
 * @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 remoteStore(String filename) throws IOException
{
  if (__dataConnectionMode == ACTIVE_REMOTE_DATA_CONNECTION_MODE ||
      __dataConnectionMode == PASSIVE_REMOTE_DATA_CONNECTION_MODE) {
    return FTPReply.isPositivePreliminary(stor(filename));
  }
  return false;
}

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

/**
 * Initiate a server to server file transfer.  This method tells the
 * server to which the client is connected to append to a given file on
 * the other server.  The other server must have had a
 * <code> remoteRetrieve </code> issued to it by another FTPClient.
 *
 * @param filename  The name of the file to be appended to, or if the
 *        file does not exist, the name to call the file being stored.
 *
 * @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 remoteAppend(String filename) throws IOException
{
  if (__dataConnectionMode == ACTIVE_REMOTE_DATA_CONNECTION_MODE ||
      __dataConnectionMode == PASSIVE_REMOTE_DATA_CONNECTION_MODE) {
    return FTPReply.isPositivePreliminary(appe(filename));
  }
  return false;
}

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

/**
 * Initiate a server to server file transfer.  This method tells the
 * server to which the client is connected to store a file on
 * the other server using a unique filename.
 * The other server must have had a <code> remoteRetrieve </code> issued
 * to it by another FTPClient.  Many FTP servers require that a base
 * filename be given from which the unique filename can be derived.  For
 * those servers use the other version of <code> remoteStoreUnique</code>
 *
 * @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 remoteStoreUnique() throws IOException
{
  if (__dataConnectionMode == ACTIVE_REMOTE_DATA_CONNECTION_MODE ||
      __dataConnectionMode == PASSIVE_REMOTE_DATA_CONNECTION_MODE) {
    return FTPReply.isPositivePreliminary(stou());
  }
  return false;
}

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

__getReply();
  if (FTPReply.isPositivePreliminary(_replyCode)) {
    __getReply();
__getReply();
if (FTPReply.isPositivePreliminary(_replyCode)) {
  __getReply();

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

if (!FTPReply.isPositivePreliminary(sendCommand(command, arg))) {
    return null;
if (!FTPReply.isPositivePreliminary(sendCommand(command, arg)))

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

if (!FTPReply.isPositivePreliminary(sendCommand(command, arg))) {
  socket.close();
  return null;

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

/**
 * Reinitialize the FTP session.  Not all FTP servers support this
 * command, which issues the FTP REIN command.
 *
 * @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.4 (made public)
 */
public boolean reinitialize() throws IOException
{
  rein();
  if (FTPReply.isPositiveCompletion(_replyCode) ||
      (FTPReply.isPositivePreliminary(_replyCode) &&
          FTPReply.isPositiveCompletion(getReply())))
  {
    __initDefaults();
    return true;
  }
  return false;
}

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

/***
 * Initiate a server to server file transfer.  This method tells the
 * server to which the client is connected to retrieve a given file from
 * the other server.
 * <p>
 * @param filename  The name of the file to retrieve.
 * @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 remoteRetrieve(String filename) throws IOException
{
  if (__dataConnectionMode == ACTIVE_REMOTE_DATA_CONNECTION_MODE ||
      __dataConnectionMode == PASSIVE_REMOTE_DATA_CONNECTION_MODE)
    return FTPReply.isPositivePreliminary(retr(filename));
  return false;
}

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

/***
 * Initiate a server to server file transfer.  This method tells the
 * server to which the client is connected to retrieve a given file from
 * the other server.
 * <p>
 * @param filename  The name of the file to retrieve.
 * @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 remoteRetrieve(String filename) throws IOException
{
  if (__dataConnectionMode == ACTIVE_REMOTE_DATA_CONNECTION_MODE ||
      __dataConnectionMode == PASSIVE_REMOTE_DATA_CONNECTION_MODE)
    return FTPReply.isPositivePreliminary(retr(filename));
  return false;
}

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

/***
 * Initiate a server to server file transfer.  This method tells the
 * server to which the client is connected to append to a given file on
 * the other server.  The other server must have had a
 * <code> remoteRetrieve </code> issued to it by another FTPClient.
 * <p>
 * @param filename  The name of the file to be appended to, or if the
 *        file does not exist, the name to call the file being stored.
 * <p>
 * @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 remoteAppend(String filename) throws IOException
{
  if (__dataConnectionMode == ACTIVE_REMOTE_DATA_CONNECTION_MODE ||
      __dataConnectionMode == PASSIVE_REMOTE_DATA_CONNECTION_MODE)
    return FTPReply.isPositivePreliminary(stor(filename));
  return false;
}

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

/***
 * Initiate a server to server file transfer.  This method tells the
 * server to which the client is connected to store a file on
 * the other server using the given filename.  The other server must
 * have had a <code> remoteRetrieve </code> issued to it by another
 * FTPClient.
 * <p>
 * @param filename  The name to call the file that is to be stored.
 * @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 remoteStore(String filename) throws IOException
{
  if (__dataConnectionMode == ACTIVE_REMOTE_DATA_CONNECTION_MODE ||
      __dataConnectionMode == PASSIVE_REMOTE_DATA_CONNECTION_MODE)
    return FTPReply.isPositivePreliminary(stor(filename));
  return false;
}

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

/***
 * Initiate a server to server file transfer.  This method tells the
 * server to which the client is connected to store a file on
 * the other server using the given filename.  The other server must
 * have had a <code> remoteRetrieve </code> issued to it by another
 * FTPClient.
 * <p>
 * @param filename  The name to call the file that is to be stored.
 * @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 remoteStore(String filename) throws IOException
{
  if (__dataConnectionMode == ACTIVE_REMOTE_DATA_CONNECTION_MODE ||
      __dataConnectionMode == PASSIVE_REMOTE_DATA_CONNECTION_MODE)
    return FTPReply.isPositivePreliminary(stor(filename));
  return false;
}

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

/**
 * Initiates control connections and gets initial reply.
 * Initializes {@link #_controlInput_} and {@link #_controlOutput_}.
 */
@Override
protected void _connectAction_() throws IOException
{
  super._connectAction_();
  _controlInput_ =
    new BufferedReader(new InputStreamReader(_socket_.getInputStream(),
                         getControlEncoding()));
  _controlOutput_ =
    new BufferedWriter(new OutputStreamWriter(_socket_.getOutputStream(),
                         getControlEncoding()));
  __getReply();
  // If we received code 120, we have to fetch completion reply.
  if (FTPReply.isPositivePreliminary(_replyCode))
    __getReply();
}

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

protected void _connectAction_() throws IOException
{
  super._connectAction_();
  _controlInput =
    new BufferedReader(new InputStreamReader(getInputStream(),
                         getControlEncoding()));
  _controlOutput =
    new BufferedWriter(new OutputStreamWriter(getOutputStream(),
                         getControlEncoding()));
  __getReply();
  // If we received code 120, we have to fetch completion reply.
  if (FTPReply.isPositivePreliminary(_replyCode))
    __getReply();
}

代码示例来源:origin: org.onebusaway/onebusaway-transit-data-federation

private void downloadUpdatedFiles(List<String> toDownload) throws IOException {
 for (String path : toDownload) {
  _log.debug("downloading path: {}", path);
  long t3 = System.currentTimeMillis();
  InputStream in = _ftpClient.retrieveFileStream(path);
  if (!FTPReply.isPositivePreliminary(_ftpClient.getReplyCode())) {
   _log.warn("error initiating file transfer: "
     + _ftpClient.getReplyCode() + " " + _ftpClient.getReplyString());
   continue;
  }
  _reader.readEntities(OrbcadRecord.class, in);
  in.close();
  if (!_ftpClient.completePendingCommand()) {
   _log.warn("error completing file transfer: "
     + _ftpClient.getReplyCode() + " " + _ftpClient.getReplyString());
   continue;
  }
  long t4 = System.currentTimeMillis();
  if (_log.isDebugEnabled())
   _log.info("file download time: " + (t4 - t3));
 }
}

代码示例来源:origin: OneBusAway/onebusaway-application-modules

private void downloadUpdatedFiles(List<String> toDownload) throws IOException {
 for (String path : toDownload) {
  _log.debug("downloading path: {}", path);
  long t3 = SystemTime.currentTimeMillis();
  InputStream in = _ftpClient.retrieveFileStream(path);
  if (!FTPReply.isPositivePreliminary(_ftpClient.getReplyCode())) {
   _log.warn("error initiating file transfer: "
     + _ftpClient.getReplyCode() + " " + _ftpClient.getReplyString());
   continue;
  }
  _reader.readEntities(OrbcadRecord.class, in);
  in.close();
  if (!_ftpClient.completePendingCommand()) {
   _log.warn("error completing file transfer: "
     + _ftpClient.getReplyCode() + " " + _ftpClient.getReplyString());
   continue;
  }
  long t4 = SystemTime.currentTimeMillis();
  if (_log.isDebugEnabled())
   _log.info("file download time: " + (t4 - t3));
 }
}

相关文章