Example usage for org.apache.commons.net.ftp FTPCmd getCommand

List of usage examples for org.apache.commons.net.ftp FTPCmd getCommand

Introduction

In this page you can find the example usage for org.apache.commons.net.ftp FTPCmd getCommand.

Prototype

public final String getCommand() 

Source Link

Document

Retrieve the FTP protocol command string corresponding to a specified command code.

Usage

From source file:com.consol.citrus.ftp.message.FtpMessage.java

/**
 * Default constructor using command as payload.
 * @param command/*from   w w  w  .  ja  v a  2s .  c  om*/
 */
public FtpMessage(FTPCmd command, String arguments) {
    super(command.getCommand());

    setHeader(FtpMessageHeaders.FTP_COMMAND, command.getCommand());
    setHeader(FtpMessageHeaders.FTP_ARGS, arguments);
}

From source file:ch.cyberduck.core.ftp.FTPClient.java

/**
 * http://drftpd.org/index.php/PRET_Specifications
 *
 * @param command Command to execute//from w ww  .j ava2  s.  c  om
 * @param file    Remote file
 * @throws IOException I/O failure
 */
protected void pret(final FTPCmd command, final String file) throws IOException {
    if (this.hasFeature("PRET")) {
        if (!FTPReply.isPositiveCompletion(
                this.sendCommand("PRET", String.format("%s %s", command.getCommand(), file)))) {
            throw new FTPException(this.getReplyCode(), this.getReplyString());
        }
    }
}

From source file:com.atomicleopard.thundr.ftp.commons.FTP.java

/**
 * Sends an FTP command to the server, waits for a reply and returns the
 * numerical response code.  After invocation, for more detailed
 * information, the actual reply text can be accessed by calling
 * {@link #getReplyString  getReplyString } or
 * {@link #getReplyStrings  getReplyStrings }.
 * <p>//from   www  .j  a  v a2  s.c  o m
 * @param command  The FTPCmd enum corresponding to the FTP command
 *                 to send.
 * @param args The arguments to the FTP command.  If this parameter is
 *             set to null, then the command is sent with no argument.
 * @return The integer value of the FTP reply code returned by the server
 *         in response to the command.
 * @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 the
 *      command or receiving the server reply.
 * @since 3.3
 */
public int sendCommand(FTPCmd command, String args) throws IOException {
    return sendCommand(command.getCommand(), args);
}

From source file:com.atomicleopard.thundr.ftp.commons.FTPClient.java

private OutputStream __storeFileStream(FTPCmd command, String remote) throws IOException {
    return _storeFileStream(command.getCommand(), remote);
}

From source file:com.atomicleopard.thundr.ftp.commons.FTPClient.java

/**
 * Establishes a data connection with the FTP server, returning
 * a Socket for the connection if successful.  If a restart
 * offset has been set with {@link #setRestartOffset(long)},
 * a REST command is issued to the server with the offset as
 * an argument before establishing the data connection.  Active
 * mode connections also cause a local PORT command to be issued.
 * <p>// w  w  w. j  a  v  a 2s  .  c o m
 * @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 argument.
 * @return A Socket 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.
 * @exception IOException  If an I/O error occurs while either sending a
 *      command to the server or receiving a reply from the server.
 * @since 3.3
 */
protected Socket _openDataConnection_(FTPCmd command, String arg) throws IOException {
    return _openDataConnection_(command.getCommand(), arg);
}

From source file:com.atomicleopard.thundr.ftp.commons.FTPClient.java

private boolean __storeFile(FTPCmd command, String remote, InputStream local) throws IOException {
    return _storeFile(command.getCommand(), remote, local);
}