org.apache.commons.net.ftp
Class FTP

public class FTP
extends TelnetClient
FTP provides the basic the functionality necessary to implement your own FTP client. It extends org.apache.commons.net.TelnetClient simply because it saves the writing of extra code to handle the FTP control connection which always remains open during an FTP session and uses the Telnet protocol. Aggregation would require writing new wrapper methods and wouldn't leverage the functionality already present in org.apache.commons.net.SocketClient.

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.

SinceNot specified.
VersionNot specified.
AuthorDaniel F. Savarese
Wiki javadoc Use textile entry format.
Add your comments here.
Field Summary
static int ASCII_FILE_TYPE
A constant used to indicate the file(s) being transfered should be treated as ASCII.
static int BINARY_FILE_TYPE
A constant used to indicate the file(s) being transfered 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 transfered 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 transfered 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 transfered 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 IMAGE_FILE_TYPE
A constant used to indicate the file(s) being transfered should be treated as a binary image, i.e., no translations should be performed.
static int LOCAL_FILE_TYPE
A constant used to indicate the file(s) being transfered 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 STREAM_TRANSFER_MODE
A constant used to indicate a file is to be transfered as a stream of bytes.
static int TELNET_TEXT_FORMAT
A constant used to indicate a text file contains format vertical format control characters.
protected ProtocolCommandSupport _commandSupport_
A ProtocolCommandSupport object used to manage the registering of ProtocolCommandListeners and te firing of ProtocolCommandEvents.
Fields inherited from org.apache.commons.net.telnetTelnet
Fields inherited from org.apache.commons.net.telnetTelnetClient
Constructor Summary
FTP()
The default FTP constructor.
Method Summary
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.
void addProtocolCommandListener( ProtocolCommandListener listener )
Adds a ProtocolCommandListener.
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 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.
String getControlEncoding()
No description provided.
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.
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 mkd( String pathname )
A convenience method to send the FTP MKD 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.
void removeProtocolCommandListener( ProtocolCommandListener listener )
Removes a ProtocolCommandListener.
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( String command, String args )
Sends an FTP command to the server, waits for a reply and returns the numerical response code.
int sendCommand( int command, String args )
Sends an FTP command to the server, waits for a reply and returns the numerical response code.
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( int command )
Sends an FTP command with no arguments to the server, waits for a reply and returns the numerical response code.
void setControlEncoding( String encoding )
Sets the character encoding used by the FTP control connection.
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 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, 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 type( int fileType )
A convenience method to send the FTP TYPE command 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.
protected void _connectAction_()
No description provided.
Methods inherited from org.apache.commons.net.telnetTelnet
ASCII_FILE_TYPE
public static int ASCII_FILE_TYPE
A constant used to indicate the file(s) being transfered should be treated as ASCII. This is the default file type. All constants ending in FILE_TYPE are used to indicate file types.
Wiki javadoc Use textile entry format.
Add your comments here.
BINARY_FILE_TYPE
public static int BINARY_FILE_TYPE
A constant used to indicate the file(s) being transfered 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.
Wiki javadoc Use textile entry format.
Add your comments here.
BLOCK_TRANSFER_MODE
public static int BLOCK_TRANSFER_MODE
A constant used to indicate a file is to be transfered as a series of blocks. All constants ending in TRANSFER_MODE are used to indicate file transfer modes.
Wiki javadoc Use textile entry format.
Add your comments here.
CARRIAGE_CONTROL_TEXT_FORMAT
public static 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).
Wiki javadoc Use textile entry format.
Add your comments here.
COMPRESSED_TRANSFER_MODE
public static int COMPRESSED_TRANSFER_MODE
A constant used to indicate a file is to be transfered as FTP compressed data. All constants ending in TRANSFER_MODE are used to indicate file transfer modes.
Wiki javadoc Use textile entry format.
Add your comments here.
DEFAULT_CONTROL_ENCODING
public static 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 .
Wiki javadoc Use textile entry format.
Add your comments here.
DEFAULT_DATA_PORT
public static int DEFAULT_DATA_PORT
The default FTP data port (20).
Wiki javadoc Use textile entry format.
Add your comments here.
DEFAULT_PORT
public static int DEFAULT_PORT
The default FTP control port (21).
Wiki javadoc Use textile entry format.
Add your comments here.
EBCDIC_FILE_TYPE
public static int EBCDIC_FILE_TYPE
A constant used to indicate the file(s) being transfered 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.
Wiki javadoc Use textile entry format.
Add your comments here.
FILE_STRUCTURE
public static 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.
Wiki javadoc Use textile entry format.
Add your comments here.
IMAGE_FILE_TYPE
public static int IMAGE_FILE_TYPE
A constant used to indicate the file(s) being transfered 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.
Wiki javadoc Use textile entry format.
Add your comments here.
LOCAL_FILE_TYPE
public static int LOCAL_FILE_TYPE
A constant used to indicate the file(s) being transfered should be treated as a local type. All constants ending in FILE_TYPE are used to indicate file types.
Wiki javadoc Use textile entry format.
Add your comments here.
NON_PRINT_TEXT_FORMAT
public static 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).
Wiki javadoc Use textile entry format.
Add your comments here.
PAGE_STRUCTURE
public static 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.
Wiki javadoc Use textile entry format.
Add your comments here.
RECORD_STRUCTURE
public static 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.
Wiki javadoc Use textile entry format.
Add your comments here.
STREAM_TRANSFER_MODE
public static int STREAM_TRANSFER_MODE
A constant used to indicate a file is to be transfered as a stream of bytes. This is the default transfer mode. All constants ending in TRANSFER_MODE are used to indicate file transfer modes.
Wiki javadoc Use textile entry format.
Add your comments here.
TELNET_TEXT_FORMAT
public static 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).
Wiki javadoc Use textile entry format.
Add your comments here.
_commandSupport_
protected ProtocolCommandSupport _commandSupport_
A ProtocolCommandSupport object used to manage the registering of ProtocolCommandListeners and te firing of ProtocolCommandEvents.
Wiki javadoc Use textile entry format.
Add your comments here.
FTP
public FTP ( )
The default FTP constructor. Sets the default port to DEFAULT_PORT and initializes internal data structures for saving FTP reply information.
Wiki javadoc Use textile entry format.
Add your comments here.
abor
public int abor ( )
throws
A convenience method to send the FTP ABOR command to the server, receive the reply, and return the reply code.

Exceptions
IOException If an I/O error occurs while either sending the command or receiving the server reply.
Wiki javadoc Use textile entry format.
Add your comments here.
acct
public int acct ( String account )
throws
A convenience method to send the FTP ACCT command to the server, receive the reply, and return the reply code.

Parameters
TypeNameDescription
String account The account name to access.
Exceptions
IOException If an I/O error occurs while either sending the command or receiving the server reply.
Wiki javadoc Use textile entry format.
Add your comments here.
addProtocolCommandListener
public void addProtocolCommandListener ( ProtocolCommandListener listener )
Adds a ProtocolCommandListener. Delegates this task to _commandSupport_ .

Parameters
TypeNameDescription
ProtocolCommandListener listener The ProtocolCommandListener to add.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
allo
public int allo ( int bytes )
throws
A convenience method to send the FTP ALLO command to the server, receive the reply, and return the reply code.

Parameters
TypeNameDescription
int bytes The number of bytes to allocate.
Exceptions
IOException If an I/O error occurs while either sending the command or receiving the server reply.
Wiki javadoc Use textile entry format.
Add your comments here.
allo
public int allo ( int bytes, int recordSize )
throws
A convenience method to send the FTP ALLO command to the server, receive the reply, and return the reply code.

Parameters
TypeNameDescription
int bytes The number of bytes to allocate.
int recordSize The size of a record.
Exceptions
IOException If an I/O error occurs while either sending the command or receiving the server reply.
Wiki javadoc Use textile entry format.
Add your comments here.
appe
public int appe ( String pathname )
throws
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
TypeNameDescription
String pathname The pathname to use for the file when stored at the remote end of the transfer.
Exceptions
IOException If an I/O error occurs while either sending the command or receiving the server reply.
Wiki javadoc Use textile entry format.
Add your comments here.
cdup
public int cdup ( )
throws
A convenience method to send the FTP CDUP command to the server, receive the reply, and return the reply code.

Exceptions
IOException If an I/O error occurs while either sending the command or receiving the server reply.
Wiki javadoc Use textile entry format.
Add your comments here.
cwd
public int cwd ( String directory )
throws
A convenience method to send the FTP CWD command to the server, receive the reply, and return the reply code.

Parameters
TypeNameDescription
String directory The new working directory.
Exceptions
IOException If an I/O error occurs while either sending the command or receiving the server reply.
Wiki javadoc Use textile entry format.
Add your comments here.
dele
public int dele ( String pathname )
throws
A convenience method to send the FTP DELE command to the server, receive the reply, and return the reply code.

Parameters
TypeNameDescription
String pathname The pathname to delete.
Exceptions
IOException If an I/O error occurs while either sending the command or receiving the server reply.
Wiki javadoc Use textile entry format.
Add your comments here.
disconnect
public void disconnect ( )
throws
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.

Overrides method in TelnetClient
Returns void No description provided.
Exceptions
IOException If an error occurs while disconnecting.
Wiki javadoc Use textile entry format.
Add your comments here.
getControlEncoding
public String getControlEncoding ( )
No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
getReply
public int getReply ( )
throws
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.

Exceptions
IOException If an I/O error occurs while receiving the server reply.
Wiki javadoc Use textile entry format.
Add your comments here.
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.

Wiki javadoc Use textile entry format.
Add your comments here.
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.

Wiki javadoc Use textile entry format.
Add your comments here.
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.

Wiki javadoc Use textile entry format.
Add your comments here.
help
public int help ( )
throws
A convenience method to send the FTP HELP command to the server, receive the reply, and return the reply code.

Exceptions
IOException If an I/O error occurs while either sending the command or receiving the server reply.
Wiki javadoc Use textile entry format.
Add your comments here.
help
public int help ( String command )
throws
A convenience method to send the FTP HELP command to the server, receive the reply, and return the reply code.

Parameters
TypeNameDescription
String command The command name on which to request help.
Exceptions
IOException If an I/O error occurs while either sending the command or receiving the server reply.
Wiki javadoc Use textile entry format.
Add your comments here.
list
public int list ( )
throws
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.

Exceptions
IOException If an I/O error occurs while either sending the command or receiving the server reply.
Wiki javadoc Use textile entry format.
Add your comments here.
list
public int list ( String pathname )
throws
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
TypeNameDescription
String pathname The pathname to list.
Exceptions
IOException If an I/O error occurs while either sending the command or receiving the server reply.
Wiki javadoc Use textile entry format.
Add your comments here.
mkd
public int mkd ( String pathname )
throws
A convenience method to send the FTP MKD command to the server, receive the reply, and return the reply code.

Parameters
TypeNameDescription
String pathname The pathname of the new directory to create.
Exceptions
IOException If an I/O error occurs while either sending the command or receiving the server reply.
Wiki javadoc Use textile entry format.
Add your comments here.
mode
public int mode ( int mode )
throws
A convenience method to send the FTP MODE command to the server, receive the reply, and return the reply code.

Parameters
TypeNameDescription
int mode The transfer mode to use (one of the TRANSFER_MODE constants).
Exceptions
IOException If an I/O error occurs while either sending the command or receiving the server reply.
Wiki javadoc Use textile entry format.
Add your comments here.
nlst
public int nlst ( )
throws
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.

Exceptions
IOException If an I/O error occurs while either sending the command or receiving the server reply.
Wiki javadoc Use textile entry format.
Add your comments here.
nlst
public int nlst ( String pathname )
throws
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
TypeNameDescription
String pathname The pathname to list.
Exceptions
IOException If an I/O error occurs while either sending the command or receiving the server reply.
Wiki javadoc Use textile entry format.
Add your comments here.
noop
public int noop ( )
throws
A convenience method to send the FTP NOOP command to the server, receive the reply, and return the reply code.

Exceptions
IOException If an I/O error occurs while either sending the command or receiving the server reply.
Wiki javadoc Use textile entry format.
Add your comments here.
pass
public int pass ( String password )
throws
A convenience method to send the FTP PASS command to the server, receive the reply, and return the reply code.
Parameters
TypeNameDescription
String password The plain text password of the username being logged into.
Exceptions
IOException If an I/O error occurs while either sending the command or receiving the server reply.
Wiki javadoc Use textile entry format.
Add your comments here.
pasv
public int pasv ( )
throws
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.

Exceptions
IOException If an I/O error occurs while either sending the command or receiving the server reply.
Wiki javadoc Use textile entry format.
Add your comments here.
port
public int port ( InetAddress host, int port )
throws
A convenience method to send the FTP PORT command to the server, receive the reply, and return the reply code.

Parameters
TypeNameDescription
InetAddress host The host owning the port.
int port The new port.
Exceptions
IOException If an I/O error occurs while either sending the command or receiving the server reply.
Wiki javadoc Use textile entry format.
Add your comments here.
pwd
public int pwd ( )
throws
A convenience method to send the FTP PWD command to the server, receive the reply, and return the reply code.

Exceptions
IOException If an I/O error occurs while either sending the command or receiving the server reply.
Wiki javadoc Use textile entry format.
Add your comments here.
quit
public int quit ( )
throws
A convenience method to send the FTP QUIT command to the server, receive the reply, and return the reply code.

Exceptions
IOException If an I/O error occurs while either sending the command or receiving the server reply.
Wiki javadoc Use textile entry format.
Add your comments here.
rein
public int rein ( )
throws
A convenience method to send the FTP REIN command to the server, receive the reply, and return the reply code.

Exceptions
IOException If an I/O error occurs while either sending the command or receiving the server reply.
Wiki javadoc Use textile entry format.
Add your comments here.
removeProtocolCommandListener
public void removeProtocolCommandListener ( ProtocolCommandListener listener )
Removes a ProtocolCommandListener. Delegates this task to _commandSupport_ .

Parameters
TypeNameDescription
ProtocolCommandListener listener The ProtocolCommandListener to remove.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
rest
public int rest ( String marker )
throws
A convenience method to send the FTP REST command to the server, receive the reply, and return the reply code.

Parameters
TypeNameDescription
String marker The marker at which to restart a transfer.
Exceptions
IOException If an I/O error occurs while either sending the command or receiving the server reply.
Wiki javadoc Use textile entry format.
Add your comments here.
retr
public int retr ( String pathname )
throws
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
TypeNameDescription
String pathname The pathname of the file to retrieve.
Exceptions
IOException If an I/O error occurs while either sending the command or receiving the server reply.
Wiki javadoc Use textile entry format.
Add your comments here.
rmd
public int rmd ( String pathname )
throws
A convenience method to send the FTP RMD command to the server, receive the reply, and return the reply code.

Parameters
TypeNameDescription
String pathname The pathname of the directory to remove.
Exceptions
IOException If an I/O error occurs while either sending the command or receiving the server reply.
Wiki javadoc Use textile entry format.
Add your comments here.
rnfr
public int rnfr ( String pathname )
throws
A convenience method to send the FTP RNFR command to the server, receive the reply, and return the reply code.

Parameters
TypeNameDescription
String pathname The pathname to rename from.
Exceptions
IOException If an I/O error occurs while either sending the command or receiving the server reply.
Wiki javadoc Use textile entry format.
Add your comments here.
rnto
public int rnto ( String pathname )
throws
A convenience method to send the FTP RNTO command to the server, receive the reply, and return the reply code.

Parameters
TypeNameDescription
String pathname The pathname to rename to
Exceptions
IOException If an I/O error occurs while either sending the command or receiving the server reply.
Wiki javadoc Use textile entry format.
Add your comments here.
sendCommand
public int sendCommand ( String command, String args )
throws
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
TypeNameDescription
String command The text representation of the FTP command to send.
String args The arguments to the FTP command. If this parameter is set to null, then the command is sent with no argument.
Exceptions
IOException If an I/O error occurs while either sending the command or receiving the server reply.
Wiki javadoc Use textile entry format.
Add your comments here.
sendCommand
public int sendCommand ( int command, String args )
throws
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
TypeNameDescription
int command The FTPCommand constant corresponding to the FTP command to send.
String args The arguments to the FTP command. If this parameter is set to null, then the command is sent with no argument.
Exceptions
IOException If an I/O error occurs while either sending the command or receiving the server reply.
Wiki javadoc Use textile entry format.
Add your comments here.
sendCommand
public int sendCommand ( String command )
throws
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
TypeNameDescription
String command The text representation of the FTP command to send.
Exceptions
IOException If an I/O error occurs while either sending the command or receiving the server reply.
Wiki javadoc Use textile entry format.
Add your comments here.
sendCommand
public int sendCommand ( int command )
throws
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
TypeNameDescription
int command The FTPCommand constant corresponding to the FTP command to send.
Exceptions
IOException If an I/O error occurs while either sending the command or receiving the server reply.
Wiki javadoc Use textile entry format.
Add your comments here.
setControlEncoding
public void setControlEncoding ( String encoding )
Sets the character encoding used by the FTP control connection. Some FTP servers require that commands be issued in a non-ASCII encoding like UTF-8 so that filenames with multi-byte character representations (e.g, Big 8) can be specified.
Parameters
TypeNameDescription
String encoding The new character encoding for the control connection.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
site
public int site ( String parameters )
throws
A convenience method to send the FTP SITE command to the server, receive the reply, and return the reply code.

Parameters
TypeNameDescription
String parameters The site parameters to send.
Exceptions
IOException If an I/O error occurs while either sending the command or receiving the server reply.
Wiki javadoc Use textile entry format.
Add your comments here.
smnt
public int smnt ( String dir )
throws
A convenience method to send the FTP SMNT command to the server, receive the reply, and return the reply code.

Parameters
TypeNameDescription
String dir The directory name.
Exceptions
IOException If an I/O error occurs while either sending the command or receiving the server reply.
Wiki javadoc Use textile entry format.
Add your comments here.
stat
public int stat ( )
throws
A convenience method to send the FTP STAT command to the server, receive the reply, and return the reply code.

Exceptions
IOException If an I/O error occurs while either sending the command or receiving the server reply.
Wiki javadoc Use textile entry format.
Add your comments here.
stat
public int stat ( String pathname )
throws
A convenience method to send the FTP STAT command to the server, receive the reply, and return the reply code.

Parameters
TypeNameDescription
String pathname A pathname to list.
Exceptions
IOException If an I/O error occurs while either sending the command or receiving the server reply.
Wiki javadoc Use textile entry format.
Add your comments here.
stor
public int stor ( String pathname )
throws
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
TypeNameDescription
String pathname The pathname to use for the file when stored at the remote end of the transfer.
Exceptions
IOException If an I/O error occurs while either sending the command or receiving the server reply.
Wiki javadoc Use textile entry format.
Add your comments here.
stou
public int stou ( )
throws
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.

Exceptions
IOException If an I/O error occurs while either sending the command or receiving the server reply.
Wiki javadoc Use textile entry format.
Add your comments here.
stou
public int stou ( String pathname )
throws
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
TypeNameDescription
String pathname The base pathname to use for the file when stored at the remote end of the transfer. Some FTP servers require this.
Exceptions
IOException If an I/O error occurs while either sending the command or receiving the server reply.
Wiki javadoc Use textile entry format.
Add your comments here.
stru
public int stru ( int structure )
throws
A convenience method to send the FTP STRU command to the server, receive the reply, and return the reply code.

Parameters
TypeNameDescription
int structure The structure of the file (one of the _STRUCTURE constants).
Exceptions
IOException If an I/O error occurs while either sending the command or receiving the server reply.
Wiki javadoc Use textile entry format.
Add your comments here.
syst
public int syst ( )
throws
A convenience method to send the FTP SYST command to the server, receive the reply, and return the reply code.

Exceptions
IOException If an I/O error occurs while either sending the command or receiving the server reply.
Wiki javadoc Use textile entry format.
Add your comments here.
type
public int type ( int fileType, int formatOrByteSize )
throws
A convenience method to send the FTP TYPE command for text files to the server, receive the reply, and return the reply code.
Parameters
TypeNameDescription
int fileType The type of the file (one of the FILE_TYPE constants).
int formatOrByteSize The format of the file (one of the _FORMAT constants. In the case of LOCAL_FILE_TYPE, the byte size.
Exceptions
IOException If an I/O error occurs while either sending the command or receiving the server reply.
Wiki javadoc Use textile entry format.
Add your comments here.
type
public int type ( int fileType )
throws
A convenience method to send the FTP TYPE command to the server, receive the reply, and return the reply code.

Parameters
TypeNameDescription
int fileType The type of the file (one of the FILE_TYPE constants).
Exceptions
IOException If an I/O error occurs while either sending the command or receiving the server reply.
Wiki javadoc Use textile entry format.
Add your comments here.
user
public int user ( String username )
throws
A convenience method to send the FTP USER command to the server, receive the reply, and return the reply code.

Parameters
TypeNameDescription
String username The username to login under.
Exceptions
IOException If an I/O error occurs while either sending the command or receiving the server reply.
Wiki javadoc Use textile entry format.
Add your comments here.
_connectAction_
protected void _connectAction_ ( )
throws
No description provided.
Overrides method in TelnetClient
Returns void No description provided.
Exceptions
IOException No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.