示例#1
0
  /**
   * Return the FTP request as a string
   *
   * @return String
   */
  public String toString() {
    StringBuffer str = new StringBuffer();

    str.append("[");
    str.append(FTPCommand.getCommandName(m_cmd));
    str.append(":");
    str.append(m_arg);
    str.append("]");

    return str.toString();
  }
示例#2
0
  /**
   * Parse a command string
   *
   * @param cmdLine String
   */
  protected final void parseCommandLine(String cmdLine) {

    //	Check if the command has an argument

    int pos = cmdLine.indexOf(' ');
    String cmd = null;

    if (pos != -1) {
      cmd = cmdLine.substring(0, pos);
      m_arg = cmdLine.substring(pos + 1);
    } else cmd = cmdLine;

    //	Validate the FTP command

    m_cmd = FTPCommand.getCommandId(cmd);
  }
示例#3
0
 /**
  * Returns a socket of the data connection. Wrapped as an {@link SSLSocket}, which carries out
  * handshake processing.
  *
  * @param command The int representation of the FTP command to send.
  * @param arg The arguments to the FTP command. If this parameter is set to null, then the command
  *     is sent with no arguments.
  * @return corresponding to the established data connection. Null is returned if an FTP protocol
  *     error is reported at any point during the establishment and initialization of the
  *     connection.
  * @throws IOException If there is any problem with the connection.
  * @see FTPClient#_openDataConnection_(int, String)
  */
 @Override
 // Strictly speaking this is not needed, but it works round a Clirr bug
 // So rather than invoke the parent code, we do it here
 protected Socket _openDataConnection_(int command, String arg) throws IOException {
   return _openDataConnection_(FTPCommand.getCommand(command), arg);
 }