org.apache.commons.net.ftp

## Class FTP

- java.lang.Object
- - org.apache.commons.net.SocketClient
  - - org.apache.commons.net.ftp.FTP

- Direct Known Subclasses:
    FTPClient

      public class FTP
      extends SocketClient

  FTP provides the basic the functionality necessary to implement your own FTP client. It extends org.apache.commons.net.SocketClient since extending TelnetClient was causing unwanted behavior (like connections that did not time out properly).

  To derive the full benefits of the FTP class requires some knowledge of the FTP protocol defined in RFC 959. However, there is no reason why you should have to use the FTP class. The `FTPClient` class, derived from FTP, implements all the functionality required of an FTP client. The FTP class is made public to provide access to various FTP constants and to make it easier for adventurous programmers (or those with special needs) to interact with the FTP protocol and implement their own clients. A set of methods with names corresponding to the FTP command names are provided to facilitate this interaction.

  You should keep in mind that the FTP server may choose to prematurely close a connection if the client has been idle for longer than a given time period (usually 900 seconds). The FTP class will detect a premature FTP server connection closing when it receives a `FTPReply.SERVICE_NOT_AVAILABLE` response to a command. When that occurs, the FTP class method encountering that reply will throw an `FTPConnectionClosedException` . `FTPConectionClosedException` is a subclass of `IOException` and therefore need not be caught separately, but if you are going to catch it separately, its catch block must appear before the more general `IOException` catch block. When you encounter an `FTPConnectionClosedException` , you must disconnect the connection with `disconnect()` to properly clean up the system resources used by FTP. Before disconnecting, you may check the last reply code and text with `getReplyCode` , `getReplyString` , and `getReplyStrings`. You may avoid server disconnections while the client is idle by periodicaly sending NOOP commands to the server.

  Rather than list it separately for each method, we mention here that every method communicating with the server and throwing an IOException can also throw a `MalformedServerReplyException` , which is a subclass of IOException. A MalformedServerReplyException will be thrown when the reply received from the server deviates enough from the protocol specification that it cannot be interpreted in a useful manner despite attempts to be as lenient as possible.

  See Also:
    `FTPClient`, `FTPConnectionClosedException`, `MalformedServerReplyException`

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected ProtocolCommandSupport` | `_commandSupport_` A ProtocolCommandSupport object used to manage the registering of ProtocolCommandListeners and the firing of ProtocolCommandEvents.
    `protected String` | `_controlEncoding`
    `protected BufferedReader` | `_controlInput_` Wraps SocketClient._input_ to facilitate the reading of text from the FTP control connection.
    `protected BufferedWriter` | `_controlOutput_` Wraps SocketClient._output_ to facilitate the writing of text to the FTP control connection.
    `protected boolean` | `_newReplyString`
    `protected int` | `_replyCode`
    `protected ArrayList<String>` | `_replyLines`
    `protected String` | `_replyString`
    `static int` | `ASCII_FILE_TYPE` A constant used to indicate the file(s) being transferred should be treated as ASCII.
    `static int` | `BINARY_FILE_TYPE` A constant used to indicate the file(s) being transferred should be treated as a binary image, i.e., no translations should be performed.
    `static int` | `BLOCK_TRANSFER_MODE` A constant used to indicate a file is to be transferred as a series of blocks.
    `static int` | `CARRIAGE_CONTROL_TEXT_FORMAT` A constant used to indicate a text file contains ASA vertical format control characters.
    `static int` | `COMPRESSED_TRANSFER_MODE` A constant used to indicate a file is to be transferred as FTP compressed data.
    `static String` | `DEFAULT_CONTROL_ENCODING` The default character encoding used for communicating over an FTP control connection.
    `static int` | `DEFAULT_DATA_PORT` The default FTP data port (20).
    `static int` | `DEFAULT_PORT` The default FTP control port (21).
    `static int` | `EBCDIC_FILE_TYPE` A constant used to indicate the file(s) being transferred should be treated as EBCDIC.
    `static int` | `FILE_STRUCTURE` A constant used to indicate a file is to be treated as a continuous sequence of bytes.
    `static int` | `LOCAL_FILE_TYPE` A constant used to indicate the file(s) being transferred should be treated as a local type.
    `static int` | `NON_PRINT_TEXT_FORMAT` A constant used for text files to indicate a non-print text format.
    `static int` | `PAGE_STRUCTURE` A constant used to indicate a file is to be treated as a set of independent indexed pages.
    `static int` | `RECORD_STRUCTURE` A constant used to indicate a file is to be treated as a sequence of records.
    `static int` | `REPLY_CODE_LEN` Length of the FTP reply code (3 alphanumerics)
    `static int` | `STREAM_TRANSFER_MODE` A constant used to indicate a file is to be transferred as a stream of bytes.
    `protected boolean` | `strictMultilineParsing` This is used to signal whether a block of multiline responses beginning with xxx must be terminated by the same numeric code xxx See section 4.2 of RFC 959 for details.
    `static int` | `TELNET_TEXT_FORMAT` A constant used to indicate a text file contains format vertical format control characters.

    - ### Fields inherited from class org.apache.commons.net.SocketClient

      `_defaultPort_, _hostname_, _input_, _output_, _serverSocketFactory_, _socket_, _socketFactory_, _timeout_, connectTimeout, NETASCII_EOL`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `FTP()` The default FTP constructor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `__getReplyNoReport()` Get the reply, but don't pass it to command listeners.
    `protected void` | `__noop()` Send a noop and get the reply without reporting to the command listener.
    `protected void` | `_connectAction_()` Initiates control connections and gets initial reply.
    `protected void` | `_connectAction_(Reader socketIsReader)` Initiates control connections and gets initial reply.
    `int` | `abor()` A convenience method to send the FTP ABOR command to the server, receive the reply, and return the reply code.
    `int` | `acct(String account)` A convenience method to send the FTP ACCT command to the server, receive the reply, and return the reply code.
    `int` | `allo(int bytes)` A convenience method to send the FTP ALLO command to the server, receive the reply, and return the reply code.
    `int` | `allo(int bytes, int recordSize)` A convenience method to send the FTP ALLO command to the server, receive the reply, and return the reply code.
    `int` | `allo(long bytes)` A convenience method to send the FTP ALLO command to the server, receive the reply, and return the reply code.
    `int` | `allo(long bytes, int recordSize)` A convenience method to send the FTP ALLO command to the server, receive the reply, and return the reply code.
    `int` | `appe(String pathname)` A convenience method to send the FTP APPE command to the server, receive the reply, and return the reply code.
    `int` | `cdup()` A convenience method to send the FTP CDUP command to the server, receive the reply, and return the reply code.
    `int` | `cwd(String directory)` A convenience method to send the FTP CWD command to the server, receive the reply, and return the reply code.
    `int` | `dele(String pathname)` A convenience method to send the FTP DELE command to the server, receive the reply, and return the reply code.
    `void` | `disconnect()` Closes the control connection to the FTP server and sets to null some internal data so that the memory may be reclaimed by the garbage collector.
    `int` | `eprt(InetAddress host, int port)` A convenience method to send the FTP EPRT command to the server, receive the reply, and return the reply code.
    `int` | `epsv()` A convenience method to send the FTP EPSV command to the server, receive the reply, and return the reply code.
    `int` | `feat()` A convenience method to send the FTP FEAT command to the server, receive the reply, and return the reply code.
    `protected ProtocolCommandSupport` | `getCommandSupport()` Provide command support to super-class
    `String` | `getControlEncoding()`
    `int` | `getReply()` Fetches a reply from the FTP server and returns the integer reply code.
    `int` | `getReplyCode()` Returns the integer value of the reply code of the last FTP reply.
    `String` | `getReplyString()` Returns the entire text of the last FTP server response exactly as it was received, including all end of line markers in NETASCII format.
    `String[]` | `getReplyStrings()` Returns the lines of text from the last FTP server response as an array of strings, one entry per line.
    `int` | `help()` A convenience method to send the FTP HELP command to the server, receive the reply, and return the reply code.
    `int` | `help(String command)` A convenience method to send the FTP HELP command to the server, receive the reply, and return the reply code.
    `boolean` | `isStrictMultilineParsing()` Return whether strict multiline parsing is enabled, as per RFC 959, section 4.2.
    `boolean` | `isStrictReplyParsing()` Return whether strict non-multiline parsing is enabled, as per RFC 959, section 4.2.
    `int` | `list()` A convenience method to send the FTP LIST command to the server, receive the reply, and return the reply code.
    `int` | `list(String pathname)` A convenience method to send the FTP LIST command to the server, receive the reply, and return the reply code.
    `int` | `mdtm(String file)` Sends the MDTM command for the given file.
    `int` | `mfmt(String pathname, String timeval)` A convenience method to send the FTP MFMT command to the server, receive the reply, and return the reply code.
    `int` | `mkd(String pathname)` A convenience method to send the FTP MKD command to the server, receive the reply, and return the reply code.
    `int` | `mlsd()` A convenience method to send the FTP MLSD command to the server, receive the reply, and return the reply code.
    `int` | `mlsd(String path)` A convenience method to send the FTP MLSD command to the server, receive the reply, and return the reply code.
    `int` | `mlst()` A convenience method to send the FTP MLST command to the server, receive the reply, and return the reply code.
    `int` | `mlst(String path)` A convenience method to send the FTP MLST command to the server, receive the reply, and return the reply code.
    `int` | `mode(int mode)` A convenience method to send the FTP MODE command to the server, receive the reply, and return the reply code.
    `int` | `nlst()` A convenience method to send the FTP NLST command to the server, receive the reply, and return the reply code.
    `int` | `nlst(String pathname)` A convenience method to send the FTP NLST command to the server, receive the reply, and return the reply code.
    `int` | `noop()` A convenience method to send the FTP NOOP command to the server, receive the reply, and return the reply code.
    `int` | `pass(String password)` A convenience method to send the FTP PASS command to the server, receive the reply, and return the reply code.
    `int` | `pasv()` A convenience method to send the FTP PASV command to the server, receive the reply, and return the reply code.
    `int` | `port(InetAddress host, int port)` A convenience method to send the FTP PORT command to the server, receive the reply, and return the reply code.
    `int` | `pwd()` A convenience method to send the FTP PWD command to the server, receive the reply, and return the reply code.
    `int` | `quit()` A convenience method to send the FTP QUIT command to the server, receive the reply, and return the reply code.
    `int` | `rein()` A convenience method to send the FTP REIN command to the server, receive the reply, and return the reply code.
    `int` | `rest(String marker)` A convenience method to send the FTP REST command to the server, receive the reply, and return the reply code.
    `int` | `retr(String pathname)` A convenience method to send the FTP RETR command to the server, receive the reply, and return the reply code.
    `int` | `rmd(String pathname)` A convenience method to send the FTP RMD command to the server, receive the reply, and return the reply code.
    `int` | `rnfr(String pathname)` A convenience method to send the FTP RNFR command to the server, receive the reply, and return the reply code.
    `int` | `rnto(String pathname)` A convenience method to send the FTP RNTO command to the server, receive the reply, and return the reply code.
    `int` | `sendCommand(FTPCmd command)` Sends an FTP command to the server, waits for a reply and returns the numerical response code.
    `int` | `sendCommand(FTPCmd command, String args)` Sends an FTP command to the server, waits for a reply and returns the numerical response code.
    `int` | `sendCommand(int command)` Sends an FTP command with no arguments to the server, waits for a reply and returns the numerical response code.
    `int` | `sendCommand(int command, String args)` Deprecated. (3.3) Use `sendCommand(FTPCmd, String)` instead
    `int` | `sendCommand(String command)` Sends an FTP command with no arguments to the server, waits for a reply and returns the numerical response code.
    `int` | `sendCommand(String command, String args)` Sends an FTP command to the server, waits for a reply and returns the numerical response code.
    `void` | `setControlEncoding(String encoding)` Saves the character encoding to be used by the FTP control connection.
    `void` | `setStrictMultilineParsing(boolean strictMultilineParsing)` Set strict multiline parsing.
    `void` | `setStrictReplyParsing(boolean strictReplyParsing)` Set strict non-multiline parsing.
    `int` | `site(String parameters)` A convenience method to send the FTP SITE command to the server, receive the reply, and return the reply code.
    `int` | `size(String parameters)` A convenience method to send the FTP SIZE command to the server, receive the reply, and return the reply code.
    `int` | `smnt(String dir)` A convenience method to send the FTP SMNT command to the server, receive the reply, and return the reply code.
    `int` | `stat()` A convenience method to send the FTP STAT command to the server, receive the reply, and return the reply code.
    `int` | `stat(String pathname)` A convenience method to send the FTP STAT command to the server, receive the reply, and return the reply code.
    `int` | `stor(String pathname)` A convenience method to send the FTP STOR command to the server, receive the reply, and return the reply code.
    `int` | `stou()` A convenience method to send the FTP STOU command to the server, receive the reply, and return the reply code.
    `int` | `stou(String pathname)` A convenience method to send the FTP STOU command to the server, receive the reply, and return the reply code.
    `int` | `stru(int structure)` A convenience method to send the FTP STRU command to the server, receive the reply, and return the reply code.
    `int` | `syst()` A convenience method to send the FTP SYST command to the server, receive the reply, and return the reply code.
    `int` | `type(int fileType)` A convenience method to send the FTP TYPE command to the server, receive the reply, and return the reply code.
    `int` | `type(int fileType, int formatOrByteSize)` A convenience method to send the FTP TYPE command for text files to the server, receive the reply, and return the reply code.
    `int` | `user(String username)` A convenience method to send the FTP USER command to the server, receive the reply, and return the reply code.

    - ### Methods inherited from class org.apache.commons.net.SocketClient

      `addProtocolCommandListener, applySocketAttributes, connect, connect, connect, connect, connect, connect, createCommandSupport, fireCommandSent, fireReplyReceived, getCharset, getCharsetName, getConnectTimeout, getDefaultPort, getDefaultTimeout, getKeepAlive, getLocalAddress, getLocalPort, getProxy, getReceiveBufferSize, getRemoteAddress, getRemotePort, getSendBufferSize, getServerSocketFactory, getSoLinger, getSoTimeout, getTcpNoDelay, isAvailable, isConnected, removeProtocolCommandListener, setCharset, setConnectTimeout, setDefaultPort, setDefaultTimeout, setKeepAlive, setProxy, setReceiveBufferSize, setSendBufferSize, setServerSocketFactory, setSocketFactory, setSoLinger, setSoTimeout, setTcpNoDelay, verifyRemote`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### DEFAULT_DATA_PORT

          public static final int DEFAULT_DATA_PORT

      The default FTP data port (20).
      See Also:
        Constant Field Values

    - #### DEFAULT_PORT

          public static final int DEFAULT_PORT

      The default FTP control port (21).
      See Also:
        Constant Field Values

    - #### ASCII_FILE_TYPE

          public static final int ASCII_FILE_TYPE

      A constant used to indicate the file(s) being transferred should be treated as ASCII. This is the default file type. All constants ending in `FILE_TYPE` are used to indicate file types.
      See Also:
        Constant Field Values

    - #### EBCDIC_FILE_TYPE

          public static final int EBCDIC_FILE_TYPE

      A constant used to indicate the file(s) being transferred should be treated as EBCDIC. Note however that there are several different EBCDIC formats. All constants ending in `FILE_TYPE` are used to indicate file types.
      See Also:
        Constant Field Values

    - #### BINARY_FILE_TYPE

          public static final int BINARY_FILE_TYPE

      A constant used to indicate the file(s) being transferred should be treated as a binary image, i.e., no translations should be performed. All constants ending in `FILE_TYPE` are used to indicate file types.
      See Also:
        Constant Field Values

    - #### LOCAL_FILE_TYPE

          public static final int LOCAL_FILE_TYPE

      A constant used to indicate the file(s) being transferred should be treated as a local type. All constants ending in `FILE_TYPE` are used to indicate file types.
      See Also:
        Constant Field Values

    - #### NON_PRINT_TEXT_FORMAT

          public static final int NON_PRINT_TEXT_FORMAT

      A constant used for text files to indicate a non-print text format. This is the default format. All constants ending in `TEXT_FORMAT` are used to indicate text formatting for text transfers (both ASCII and EBCDIC).
      See Also:
        Constant Field Values

    - #### TELNET_TEXT_FORMAT

          public static final int TELNET_TEXT_FORMAT

      A constant used to indicate a text file contains format vertical format control characters. All constants ending in `TEXT_FORMAT` are used to indicate text formatting for text transfers (both ASCII and EBCDIC).
      See Also:
        Constant Field Values

    - #### CARRIAGE_CONTROL_TEXT_FORMAT

          public static final int CARRIAGE_CONTROL_TEXT_FORMAT

      A constant used to indicate a text file contains ASA vertical format control characters. All constants ending in `TEXT_FORMAT` are used to indicate text formatting for text transfers (both ASCII and EBCDIC).
      See Also:
        Constant Field Values

    - #### FILE_STRUCTURE

          public static final int FILE_STRUCTURE

      A constant used to indicate a file is to be treated as a continuous sequence of bytes. This is the default structure. All constants ending in `_STRUCTURE` are used to indicate file structure for file transfers.
      See Also:
        Constant Field Values

    - #### RECORD_STRUCTURE

          public static final int RECORD_STRUCTURE

      A constant used to indicate a file is to be treated as a sequence of records. All constants ending in `_STRUCTURE` are used to indicate file structure for file transfers.
      See Also:
        Constant Field Values

    - #### PAGE_STRUCTURE

          public static final int PAGE_STRUCTURE

      A constant used to indicate a file is to be treated as a set of independent indexed pages. All constants ending in `_STRUCTURE` are used to indicate file structure for file transfers.
      See Also:
        Constant Field Values

    - #### STREAM_TRANSFER_MODE

          public static final int STREAM_TRANSFER_MODE

      A constant used to indicate a file is to be transferred as a stream of bytes. This is the default transfer mode. All constants ending in `TRANSFER_MODE` are used to indicate file transfer modes.
      See Also:
        Constant Field Values

    - #### BLOCK_TRANSFER_MODE

          public static final int BLOCK_TRANSFER_MODE

      A constant used to indicate a file is to be transferred as a series of blocks. All constants ending in `TRANSFER_MODE` are used to indicate file transfer modes.
      See Also:
        Constant Field Values

    - #### COMPRESSED_TRANSFER_MODE

          public static final int COMPRESSED_TRANSFER_MODE

      A constant used to indicate a file is to be transferred as FTP compressed data. All constants ending in `TRANSFER_MODE` are used to indicate file transfer modes.
      See Also:
        Constant Field Values

    - #### DEFAULT_CONTROL_ENCODING

          public static final String DEFAULT_CONTROL_ENCODING

      The default character encoding used for communicating over an FTP control connection. The default encoding is an ASCII-compatible encoding. Some FTP servers expect other encodings. You can change the encoding used by an FTP instance with `setControlEncoding`.
      See Also:
        Constant Field Values

    - #### REPLY_CODE_LEN

          public static final int REPLY_CODE_LEN

      Length of the FTP reply code (3 alphanumerics)
      See Also:
        Constant Field Values

    - #### _replyCode

          protected int _replyCode

    - #### _replyLines

          protected ArrayList<String> _replyLines

    - #### _newReplyString

          protected boolean _newReplyString

    - #### _replyString

          protected String _replyString

    - #### _controlEncoding

          protected String _controlEncoding

    - #### _commandSupport_

          protected ProtocolCommandSupport _commandSupport_

      A ProtocolCommandSupport object used to manage the registering of ProtocolCommandListeners and the firing of ProtocolCommandEvents.

    - #### strictMultilineParsing

          protected boolean strictMultilineParsing

      This is used to signal whether a block of multiline responses beginning with xxx must be terminated by the same numeric code xxx See section 4.2 of RFC 959 for details.

    - #### _controlInput_

          protected BufferedReader _controlInput_

      Wraps SocketClient._input_ to facilitate the reading of text from the FTP control connection. Do not access the control connection via SocketClient._input_. This member starts with a null value, is initialized in `_connectAction_()`, and set to null in `disconnect()`.

    - #### _controlOutput_

          protected BufferedWriter _controlOutput_

      Wraps SocketClient._output_ to facilitate the writing of text to the FTP control connection. Do not access the control connection via SocketClient._output_. This member starts with a null value, is initialized in `_connectAction_()`, and set to null in `disconnect()`.

  - ### Constructor Detail

    - #### FTP

          public FTP()

      The default FTP constructor. Sets the default port to `DEFAULT_PORT` and initializes internal data structures for saving FTP reply information.

  - ### Method Detail

    - #### __getReplyNoReport

          protected void __getReplyNoReport()
                                     throws IOException

      Get the reply, but don't pass it to command listeners. Used for keep-alive processing only.
      Throws:
        `IOException` - on error
      Since:
        3.0

    - #### __noop

          protected void __noop()
                         throws IOException

      Send a noop and get the reply without reporting to the command listener. Intended for use with keep-alive.
      Throws:
        `IOException` - on error
      Since:
        3.0

    - #### _connectAction_

          protected void _connectAction_()
                                  throws IOException

      Initiates control connections and gets initial reply. Initializes `_controlInput_` and `_controlOutput_`.
      Overrides:
        `_connectAction_` in class `SocketClient`
      Throws:
        `IOException` - (SocketException) if a problem occurs with the socket

    - #### _connectAction_

          protected void _connectAction_(Reader socketIsReader)
                                  throws IOException

      Initiates control connections and gets initial reply. Initializes `_controlInput_` and `_controlOutput_`.
      Parameters:
        `socketIsReader` - the reader to reuse (if non-null)
      Throws:
        `IOException` - on error
      Since:
        3.4

    - #### abor

          public int abor()
                   throws IOException

      A convenience method to send the FTP ABOR command to the server, receive the reply, and return the reply code.
      Returns:
        The reply code received from the server.
      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.
        `IOException` - If an I/O error occurs while either sending the command or receiving the server reply.

    - #### acct

          public int acct(String account)
                   throws IOException

      A convenience method to send the FTP ACCT command to the server, receive the reply, and return the reply code.
      Parameters:
        `account` - The account name to access.
      Returns:
        The reply code received from the server.
      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.
        `IOException` - If an I/O error occurs while either sending the command or receiving the server reply.

    - #### allo

          public int allo(int bytes)
                   throws IOException

      A convenience method to send the FTP ALLO command to the server, receive the reply, and return the reply code.
      Parameters:
        `bytes` - The number of bytes to allocate.
      Returns:
        The reply code received from the server.
      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.
        `IOException` - If an I/O error occurs while either sending the command or receiving the server reply.

    - #### allo

          public int allo(int bytes,
                          int recordSize)
                   throws IOException

      A convenience method to send the FTP ALLO command to the server, receive the reply, and return the reply code.
      Parameters:
        `bytes` - The number of bytes to allocate.
        `recordSize` - The size of a record.
      Returns:
        The reply code received from the server.
      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.
        `IOException` - If an I/O error occurs while either sending the command or receiving the server reply.

    - #### allo

          public int allo(long bytes)
                   throws IOException

      A convenience method to send the FTP ALLO command to the server, receive the reply, and return the reply code.
      Parameters:
        `bytes` - The number of bytes to allocate.
      Returns:
        The reply code received from the server.
      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.
        `IOException` - If an I/O error occurs while either sending the command or receiving the server reply.

    - #### allo

          public int allo(long bytes,
                          int recordSize)
                   throws IOException

      A convenience method to send the FTP ALLO command to the server, receive the reply, and return the reply code.
      Parameters:
        `bytes` - The number of bytes to allocate.
        `recordSize` - The size of a record.
      Returns:
        The reply code received from the server.
      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.
        `IOException` - If an I/O error occurs while either sending the command or receiving the server reply.

    - #### appe

          public int appe(String pathname)
                   throws IOException

      A convenience method to send the FTP APPE command to the server, receive the reply, and return the reply code. Remember, it is up to you to manage the data connection. If you don't need this low level of access, use `FTPClient` , which will handle all low level details for you.
      Parameters:
        `pathname` - The pathname to use for the file when stored at the remote end of the transfer.
      Returns:
        The reply code received from the server.
      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.
        `IOException` - If an I/O error occurs while either sending the command or receiving the server reply.

    - #### cdup

          public int cdup()
                   throws IOException

      A convenience method to send the FTP CDUP command to the server, receive the reply, and return the reply code.
      Returns:
        The reply code received from the server.
      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.
        `IOException` - If an I/O error occurs while either sending the command or receiving the server reply.

    - #### cwd

          public int cwd(String directory)
                  throws IOException

      A convenience method to send the FTP CWD command to the server, receive the reply, and return the reply code.
      Parameters:
        `directory` - The new working directory.
      Returns:
        The reply code received from the server.
      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.
        `IOException` - If an I/O error occurs while either sending the command or receiving the server reply.

    - #### dele

          public int dele(String pathname)
                   throws IOException

      A convenience method to send the FTP DELE command to the server, receive the reply, and return the reply code.
      Parameters:
        `pathname` - The pathname to delete.
      Returns:
        The reply code received from the server.
      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.
        `IOException` - If an I/O error occurs while either sending the command or receiving the server reply.

    - #### disconnect

          public void disconnect()
                          throws IOException

      Closes the control connection to the FTP server and sets to null some internal data so that the memory may be reclaimed by the garbage collector. The reply text and code information from the last command is voided so that the memory it used may be reclaimed. Also sets `_controlInput_` and `_controlOutput_` to null.
      Overrides:
        `disconnect` in class `SocketClient`
      Throws:
        `IOException` - If an error occurs while disconnecting.

    - #### eprt

          public int eprt(InetAddress host,
                          int port)
                   throws IOException

      A convenience method to send the FTP EPRT command to the server, receive the reply, and return the reply code. Examples:
      - EPRT |1|132.235.1.2|6275|
      - EPRT |2|1080::8:800:200C:417A|5282|
      Parameters:
        `host` - The host owning the port.
        `port` - The new port.
      Returns:
        The reply code received from the server.
      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.
        `IOException` - If an I/O error occurs while either sending the command or receiving the server reply.
      Since:
        2.2
      See Also:
        "http://www.faqs.org/rfcs/rfc2428.html"

    - #### epsv

          public int epsv()
                   throws IOException

      A convenience method to send the FTP EPSV command to the server, receive the reply, and return the reply code. Remember, it's up to you to interpret the reply string containing the host/port information.
      Returns:
        The reply code received from the server.
      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.
        `IOException` - If an I/O error occurs while either sending the command or receiving the server reply.
      Since:
        2.2

    - #### feat

          public int feat()
                   throws IOException

      A convenience method to send the FTP FEAT command to the server, receive the reply, and return the reply code.
      Returns:
        The reply code received by the server
      Throws:
        `IOException` - If an I/O error occurs while either sending the command or receiving the server reply.
      Since:
        2.2

    - #### getCommandSupport

          protected ProtocolCommandSupport getCommandSupport()

      Provide command support to super-class
      Overrides:
        `getCommandSupport` in class `SocketClient`
      Returns:
        the CommandSupport instance, may be `null`

    - #### getControlEncoding

          public String getControlEncoding()

      Returns:
        The character encoding used to communicate over the control connection.

    - #### getReply

          public int getReply()
                       throws IOException

      Fetches a reply from the FTP server and returns the integer reply code. After calling this method, the actual reply text can be accessed from either calling `getReplyString` or `getReplyStrings` . Only use this method if you are implementing your own FTP client or if you need to fetch a secondary response from the FTP server.
      Returns:
        The integer value of the reply code of the fetched FTP reply.
      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.
        `IOException` - If an I/O error occurs while receiving the server reply.

    - #### getReplyCode

          public int getReplyCode()

      Returns the integer value of the reply code of the last FTP reply. You will usually only use this method after you connect to the FTP server to check that the connection was successful since `connect` is of type void.
      Returns:
        The integer value of the reply code of the last FTP reply.

    - #### getReplyString

          public String getReplyString()

      Returns the entire text of the last FTP server response exactly as it was received, including all end of line markers in NETASCII format.
      Returns:
        The entire text from the last FTP response as a String.

    - #### getReplyStrings

          public String[] getReplyStrings()

      Returns the lines of text from the last FTP server response as an array of strings, one entry per line. The end of line markers of each are stripped from each line.
      Returns:
        The lines of text from the last FTP response as an array.

    - #### help

          public int help()
                   throws IOException

      A convenience method to send the FTP HELP command to the server, receive the reply, and return the reply code.
      Returns:
        The reply code received from the server.
      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.
        `IOException` - If an I/O error occurs while either sending the command or receiving the server reply.

    - #### help

          public int help(String command)
                   throws IOException

      A convenience method to send the FTP HELP command to the server, receive the reply, and return the reply code.
      Parameters:
        `command` - The command name on which to request help.
      Returns:
        The reply code received from the server.
      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.
        `IOException` - If an I/O error occurs while either sending the command or receiving the server reply.

    - #### isStrictMultilineParsing

          public boolean isStrictMultilineParsing()

      Return whether strict multiline parsing is enabled, as per RFC 959, section 4.2.
      Returns:
        True if strict, false if lenient
      Since:
        2.0

    - #### isStrictReplyParsing

          public boolean isStrictReplyParsing()

      Return whether strict non-multiline parsing is enabled, as per RFC 959, section 4.2.

      The default is true, which requires the 3 digit code be followed by space and some text.
      If false, only the 3 digit code is required (as was the case for versions up to 3.5)

      Returns:
        True if strict (default), false if additional checks are not made
      Since:
        3.6

    - #### list

          public int list()
                   throws IOException

      A convenience method to send the FTP LIST command to the server, receive the reply, and return the reply code. Remember, it is up to you to manage the data connection. If you don't need this low level of access, use `FTPClient` , which will handle all low level details for you.
      Returns:
        The reply code received from the server.
      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.
        `IOException` - If an I/O error occurs while either sending the command or receiving the server reply.

    - #### list

          public int list(String pathname)
                   throws IOException

      A convenience method to send the FTP LIST command to the server, receive the reply, and return the reply code. Remember, it is up to you to manage the data connection. If you don't need this low level of access, use `FTPClient` , which will handle all low level details for you.
      Parameters:
        `pathname` - The pathname to list, may be `null` in which case the command is sent with no parameters
      Returns:
        The reply code received from the server.
      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.
        `IOException` - If an I/O error occurs while either sending the command or receiving the server reply.

    - #### mdtm

          public int mdtm(String file)
                   throws IOException

      Sends the MDTM command for the given file.
      Parameters:
        `file` - name of file
      Returns:
        the status
      Throws:
        `IOException` - on error
      Since:
        2.0

    - #### mfmt

          public int mfmt(String pathname,
                          String timeval)
                   throws IOException

      A convenience method to send the FTP MFMT command to the server, receive the reply, and return the reply code.
      Parameters:
        `pathname` - The pathname for which mtime is to be changed
        `timeval` - Timestamp in `yyyyMMDDhhmmss` format
      Returns:
        The reply code received from the server.
      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.
        `IOException` - If an I/O error occurs while either sending the command or receiving the server reply.
      Since:
        2.2
      See Also:
        http://tools.ietf.org/html/draft-somers-ftp-mfxx-04

    - #### mkd

          public int mkd(String pathname)
                  throws IOException

      A convenience method to send the FTP MKD command to the server, receive the reply, and return the reply code.
      Parameters:
        `pathname` - The pathname of the new directory to create.
      Returns:
        The reply code received from the server.
      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.
        `IOException` - If an I/O error occurs while either sending the command or receiving the server reply.

    - #### mlsd

          public int mlsd()
                   throws IOException

      A convenience method to send the FTP MLSD command to the server, receive the reply, and return the reply code. Remember, it is up to you to manage the data connection. If you don't need this low level of access, use `FTPClient` , which will handle all low level details for you.
      Returns:
        The reply code received from the server.
      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.
        `IOException` - If an I/O error occurs while either sending the command or receiving the server reply.
      Since:
        3.0

    - #### mlsd

          public int mlsd(String path)
                   throws IOException

      A convenience method to send the FTP MLSD command to the server, receive the reply, and return the reply code. Remember, it is up to you to manage the data connection. If you don't need this low level of access, use `FTPClient` , which will handle all low level details for you.
      Parameters:
        `path` - the path to report on
      Returns:
        The reply code received from the server, may be `null` in which case the command is sent with no parameters
      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.
        `IOException` - If an I/O error occurs while either sending the command or receiving the server reply.
      Since:
        3.0

    - #### mlst

          public int mlst()
                   throws IOException

      A convenience method to send the FTP MLST command to the server, receive the reply, and return the reply code. Remember, it is up to you to manage the data connection. If you don't need this low level of access, use `FTPClient` , which will handle all low level details for you.
      Returns:
        The reply code received from the server.
      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.
        `IOException` - If an I/O error occurs while either sending the command or receiving the server reply.
      Since:
        3.0

    - #### mlst

          public int mlst(String path)
                   throws IOException

      A convenience method to send the FTP MLST command to the server, receive the reply, and return the reply code. Remember, it is up to you to manage the data connection. If you don't need this low level of access, use `FTPClient` , which will handle all low level details for you.
      Parameters:
        `path` - the path to report on
      Returns:
        The reply code received from the server, may be `null` in which case the command is sent with no parameters
      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.
        `IOException` - If an I/O error occurs while either sending the command or receiving the server reply.
      Since:
        3.0

    - #### mode

          public int mode(int mode)
                   throws IOException

      A convenience method to send the FTP MODE command to the server, receive the reply, and return the reply code.
      Parameters:
        `mode` - The transfer mode to use (one of the `TRANSFER_MODE` constants).
      Returns:
        The reply code received from the server.
      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.
        `IOException` - If an I/O error occurs while either sending the command or receiving the server reply.

    - #### nlst

          public int nlst()
                   throws IOException

      A convenience method to send the FTP NLST command to the server, receive the reply, and return the reply code. Remember, it is up to you to manage the data connection. If you don't need this low level of access, use `FTPClient` , which will handle all low level details for you.
      Returns:
        The reply code received from the server.
      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.
        `IOException` - If an I/O error occurs while either sending the command or receiving the server reply.

    - #### nlst

          public int nlst(String pathname)
                   throws IOException

      A convenience method to send the FTP NLST command to the server, receive the reply, and return the reply code. Remember, it is up to you to manage the data connection. If you don't need this low level of access, use `FTPClient` , which will handle all low level details for you.
      Parameters:
        `pathname` - The pathname to list, may be `null` in which case the command is sent with no parameters
      Returns:
        The reply code received from the server.
      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.
        `IOException` - If an I/O error occurs while either sending the command or receiving the server reply.

    - #### noop

          public int noop()
                   throws IOException

      A convenience method to send the FTP NOOP command to the server, receive the reply, and return the reply code.
      Returns:
        The reply code received from the server.
      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.
        `IOException` - If an I/O error occurs while either sending the command or receiving the server reply.

    - #### pass

          public int pass(String password)
                   throws IOException

      A convenience method to send the FTP PASS command to the server, receive the reply, and return the reply code.
      Parameters:
        `password` - The plain text password of the username being logged into.
      Returns:
        The reply code received from the server.
      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.
        `IOException` - If an I/O error occurs while either sending the command or receiving the server reply.

    - #### pasv

          public int pasv()
                   throws IOException

      A convenience method to send the FTP PASV command to the server, receive the reply, and return the reply code. Remember, it's up to you to interpret the reply string containing the host/port information.
      Returns:
        The reply code received from the server.
      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.
        `IOException` - If an I/O error occurs while either sending the command or receiving the server reply.

    - #### port

          public int port(InetAddress host,
                          int port)
                   throws IOException

      A convenience method to send the FTP PORT command to the server, receive the reply, and return the reply code.
      Parameters:
        `host` - The host owning the port.
        `port` - The new port.
      Returns:
        The reply code received from the server.
      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.
        `IOException` - If an I/O error occurs while either sending the command or receiving the server reply.

    - #### pwd

          public int pwd()
                  throws IOException

      A convenience method to send the FTP PWD command to the server, receive the reply, and return the reply code.
      Returns:
        The reply code received from the server.
      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.
        `IOException` - If an I/O error occurs while either sending the command or receiving the server reply.

    - #### quit

          public int quit()
                   throws IOException

      A convenience method to send the FTP QUIT command to the server, receive the reply, and return the reply code.
      Returns:
        The reply code received from the server.
      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.
        `IOException` - If an I/O error occurs while either sending the command or receiving the server reply.

    - #### rein

          public int rein()
                   throws IOException

      A convenience method to send the FTP REIN command to the server, receive the reply, and return the reply code.
      Returns:
        The reply code received from the server.
      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.
        `IOException` - If an I/O error occurs while either sending the command or receiving the server reply.

    - #### rest

          public int rest(String marker)
                   throws IOException

      A convenience method to send the FTP REST command to the server, receive the reply, and return the reply code.
      Parameters:
        `marker` - The marker at which to restart a transfer.
      Returns:
        The reply code received from the server.
      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.
        `IOException` - If an I/O error occurs while either sending the command or receiving the server reply.

    - #### retr

          public int retr(String pathname)
                   throws IOException

      A convenience method to send the FTP RETR command to the server, receive the reply, and return the reply code. Remember, it is up to you to manage the data connection. If you don't need this low level of access, use `FTPClient` , which will handle all low level details for you.
      Parameters:
        `pathname` - The pathname of the file to retrieve.
      Returns:
        The reply code received from the server.
      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.
        `IOException` - If an I/O error occurs while either sending the command or receiving the server reply.

    - #### rmd

          public int rmd(String pathname)
                  throws IOException

      A convenience method to send the FTP RMD command to the server, receive the reply, and return the reply code.
      Parameters:
        `pathname` - The pathname of the directory to remove.
      Returns:
        The reply code received from the server.
      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.
        `IOException` - If an I/O error occurs while either sending the command or receiving the server reply.

    - #### rnfr

          public int rnfr(String pathname)
                   throws IOException

      A convenience method to send the FTP RNFR command to the server, receive the reply, and return the reply code.
      Parameters:
        `pathname` - The pathname to rename from.
      Returns:
        The reply code received from the server.
      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.
        `IOException` - If an I/O error occurs while either sending the command or receiving the server reply.

    - #### rnto

          public int rnto(String pathname)
                   throws IOException

      A convenience method to send the FTP RNTO command to the server, receive the reply, and return the reply code.
      Parameters:
        `pathname` - The pathname to rename to
      Returns:
        The reply code received from the server.
      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.
        `IOException` - If an I/O error occurs while either sending the command or receiving the server reply.

    - #### sendCommand

          public int sendCommand(FTPCmd command)
                          throws IOException

      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 `getReplyString` or `getReplyStrings` .
      Parameters:
        `command` - The FTPCmd enum corresponding to the FTP command to send.
      Returns:
        The integer value of the FTP reply code returned by the server in response to the command.
      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.
        `IOException` - If an I/O error occurs while either sending the command or receiving the server reply.
      Since:
        3.3

    - #### sendCommand

          public int sendCommand(FTPCmd command,
                                 String args)
                          throws IOException

      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 `getReplyString` or `getReplyStrings` .
      Parameters:
        `command` - The FTPCmd enum corresponding to the FTP command to send.
        `args` - The arguments to the FTP command. If this parameter is set to null, then the command is sent with no argument.
      Returns:
        The integer value of the FTP reply code returned by the server in response to the command.
      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.
        `IOException` - If an I/O error occurs while either sending the command or receiving the server reply.
      Since:
        3.3

    - #### sendCommand

          public int sendCommand(int command)
                          throws IOException

      Sends an FTP command with no arguments 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 `getReplyString` or `getReplyStrings` .
      Parameters:
        `command` - The FTPCommand constant corresponding to the FTP command to send.
      Returns:
        The integer value of the FTP reply code returned by the server in response to the command.
      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.
        `IOException` - If an I/O error occurs while either sending the command or receiving the server reply.

    - #### sendCommand

          @Deprecated
          public int sendCommand(int command,
                                             String args)
                                      throws IOException

      Deprecated. (3.3) Use `sendCommand(FTPCmd, String)` instead
      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 `getReplyString` or `getReplyStrings` .
      Parameters:
        `command` - The FTPCommand constant corresponding to the FTP command to send.
        `args` - The arguments to the FTP command. If this parameter is set to null, then the command is sent with no argument.
      Returns:
        The integer value of the FTP reply code returned by the server in response to the command.
      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.
        `IOException` - If an I/O error occurs while either sending the command or receiving the server reply.

    - #### sendCommand

          public int sendCommand(String command)
                          throws IOException

      Sends an FTP command with no arguments 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 `getReplyString` or `getReplyStrings` .
      Parameters:
        `command` - The text representation of the FTP command to send.
      Returns:
        The integer value of the FTP reply code returned by the server in response to the command.
      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.
        `IOException` - If an I/O error occurs while either sending the command or receiving the server reply.

    - #### sendCommand

          public int sendCommand(String command,
                                 String args)
                          throws IOException

      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 `getReplyString` or `getReplyStrings` .
      Parameters:
        `command` - The text representation of the FTP command to send.
        `args` - The arguments to the FTP command. If this parameter is set to null, then the command is sent with no argument.
      Returns:
        The integer value of the FTP reply code returned by the server in response to the command.
      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.
        `IOException` - If an I/O error occurs while either sending the command or receiving the server reply.

    - #### setControlEncoding

          public void setControlEncoding(String encoding)

      Saves the character encoding to be used by the FTP control connection. Some FTP servers require that commands be issued in a non-ASCII encoding like UTF-8 so that file names with multi-byte character representations (e.g, Big 8) can be specified.

      Please note that this has to be set before the connection is established.

      Parameters:
        `encoding` - The new character encoding for the control connection.

    - #### setStrictMultilineParsing

          public void setStrictMultilineParsing(boolean strictMultilineParsing)

      Set strict multiline parsing.
      Parameters:
        `strictMultilineParsing` - the setting
      Since:
        2.0

    - #### setStrictReplyParsing

          public void setStrictReplyParsing(boolean strictReplyParsing)

      Set strict non-multiline parsing.

      If true, it requires the 3 digit code be followed by space and some text.
      If false, only the 3 digit code is required (as was the case for versions up to 3.5)

      This should not be required by a well-behaved FTP server

      Parameters:
        `strictReplyParsing` - the setting
      Since:
        3.6

    - #### site

          public int site(String parameters)
                   throws IOException

      A convenience method to send the FTP SITE command to the server, receive the reply, and return the reply code.
      Parameters:
        `parameters` - The site parameters to send.
      Returns:
        The reply code received from the server.
      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.
        `IOException` - If an I/O error occurs while either sending the command or receiving the server reply.

    - #### size

          public int size(String parameters)
                   throws IOException

      A convenience method to send the FTP SIZE command to the server, receive the reply, and return the reply code.
      Parameters:
        `parameters` - The site parameters to send.
      Returns:
        The reply code received from the server.
      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.
        `IOException` - If an I/O error occurs while either sending the command or receiving the server reply.
      Since:
        3.7

    - #### smnt

          public int smnt(String dir)
                   throws IOException

      A convenience method to send the FTP SMNT command to the server, receive the reply, and return the reply code.
      Parameters:
        `dir` - The directory name.
      Returns:
        The reply code received from the server.
      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.
        `IOException` - If an I/O error occurs while either sending the command or receiving the server reply.

    - #### stat

          public int stat()
                   throws IOException

      A convenience method to send the FTP STAT command to the server, receive the reply, and return the reply code.
      Returns:
        The reply code received from the server.
      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.
        `IOException` - If an I/O error occurs while either sending the command or receiving the server reply.

    - #### stat

          public int stat(String pathname)
                   throws IOException

      A convenience method to send the FTP STAT command to the server, receive the reply, and return the reply code.
      Parameters:
        `pathname` - A pathname to list.
      Returns:
        The reply code received from the server.
      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.
        `IOException` - If an I/O error occurs while either sending the command or receiving the server reply.

    - #### stor

          public int stor(String pathname)
                   throws IOException

      A convenience method to send the FTP STOR command to the server, receive the reply, and return the reply code. Remember, it is up to you to manage the data connection. If you don't need this low level of access, use `FTPClient` , which will handle all low level details for you.
      Parameters:
        `pathname` - The pathname to use for the file when stored at the remote end of the transfer.
      Returns:
        The reply code received from the server.
      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.
        `IOException` - If an I/O error occurs while either sending the command or receiving the server reply.

    - #### stou

          public int stou()
                   throws IOException

      A convenience method to send the FTP STOU command to the server, receive the reply, and return the reply code. Remember, it is up to you to manage the data connection. If you don't need this low level of access, use `FTPClient` , which will handle all low level details for you.
      Returns:
        The reply code received from the server.
      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.
        `IOException` - If an I/O error occurs while either sending the command or receiving the server reply.

    - #### stou

          public int stou(String pathname)
                   throws IOException

      A convenience method to send the FTP STOU command to the server, receive the reply, and return the reply code. Remember, it is up to you to manage the data connection. If you don't need this low level of access, use `FTPClient` , which will handle all low level details for you.
      Parameters:
        `pathname` - The base pathname to use for the file when stored at the remote end of the transfer. Some FTP servers require this.
      Returns:
        The reply code received from the server.
      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.
        `IOException` - If an I/O error occurs while either sending the command or receiving the server reply.

    - #### stru

          public int stru(int structure)
                   throws IOException

      A convenience method to send the FTP STRU command to the server, receive the reply, and return the reply code.
      Parameters:
        `structure` - The structure of the file (one of the `_STRUCTURE` constants).
      Returns:
        The reply code received from the server.
      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.
        `IOException` - If an I/O error occurs while either sending the command or receiving the server reply.

    - #### syst

          public int syst()
                   throws IOException

      A convenience method to send the FTP SYST command to the server, receive the reply, and return the reply code.
      Returns:
        The reply code received from the server.
      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.
        `IOException` - If an I/O error occurs while either sending the command or receiving the server reply.

    - #### type

          public int type(int fileType)
                   throws IOException

      A convenience method to send the FTP TYPE command to the server, receive the reply, and return the reply code.
      Parameters:
        `fileType` - The type of the file (one of the `FILE_TYPE` constants).
      Returns:
        The reply code received from the server.
      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.
        `IOException` - If an I/O error occurs while either sending the command or receiving the server reply.

    - #### type

          public int type(int fileType,
                          int formatOrByteSize)
                   throws IOException

      A convenience method to send the FTP TYPE command for text files to the server, receive the reply, and return the reply code.
      Parameters:
        `fileType` - The type of the file (one of the `FILE_TYPE` constants).
        `formatOrByteSize` - The format of the file (one of the `_FORMAT` constants. In the case of `LOCAL_FILE_TYPE`, the byte size.
      Returns:
        The reply code received from the server.
      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.
        `IOException` - If an I/O error occurs while either sending the command or receiving the server reply.

    - #### user

          public int user(String username)
                   throws IOException

      A convenience method to send the FTP USER command to the server, receive the reply, and return the reply code.
      Parameters:
        `username` - The username to login under.
      Returns:
        The reply code received from the server.
      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.
        `IOException` - If an I/O error occurs while either sending the command or receiving the server reply.

Copyright © 2001–2022 The Apache Software Foundation. All rights reserved.