org.apache.commons.net.telnet.Telnet | +--org.apache.commons.net.telnet.TelnetClient | +--org.apache.commons.net.ftp.FTPKnown Direct Subclasses:
FTPClient
FTPConnectionClosedException
org.apache.commons.net.MalformedServerReplyException
static int | A constant used to indicate the file(s) being transfered should be treated as ASCII. |
static int | 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 | A constant used to indicate a file is to be transfered as a series of blocks. |
static int | A constant used to indicate a text file contains ASA vertical format control characters. |
static int | A constant used to indicate a file is to be transfered as FTP compressed data. |
static int | The default FTP data port (20). |
static int | The default FTP control port (21). |
static int | A constant used to indicate the file(s) being transfered should be treated as EBCDIC. |
static int | A constant used to indicate a file is to be treated as a continuous sequence of bytes. |
static int | 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 | A constant used to indicate the file(s) being transfered should be treated as a local type. |
static int | A constant used for text files to indicate a non-print text format. |
static int | A constant used to indicate a file is to be treated as a set of independent indexed pages. |
static int | A constant used to indicate a file is to be treated as a sequence of records. |
static int | A constant used to indicate a file is to be transfered as a stream of bytes. |
static int | A constant used to indicate a text file contains format vertical format control characters. |
A ProtocolCommandSupport object used to manage the registering of ProtocolCommandListeners and te firing of ProtocolCommandEvents. |
FTP() The default FTP constructor. |
void | |
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 | 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 | getReply() Fetches a reply from the FTP server and returns the integer reply code. |
int | Returns the integer value of the reply code of the last FTP reply. |
String | 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[] | 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 | removeProtocolCommandistener(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. |
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. |
public static final int ASCII_FILE_TYPE
FILE_TYPE are used to indicate file types.
public static final int BINARY_FILE_TYPE
FILE_TYPE are used to
indicate file types.
public static final int BLOCK_TRANSFER_MODE
TRANSFER_MODE are used
to indicate file transfer modes.
public static final int CARRIAGE_CONTROL_TEXT_FORMAT
TEXT_FORMAT are used to indicate
text formatting for text transfers (both ASCII and EBCDIC).
public static final int COMPRESSED_TRANSFER_MODE
TRANSFER_MODE
are used to indicate file transfer modes.
public static final int DEFAULT_DATA_PORT
public static final int DEFAULT_PORT
public static final int EBCDIC_FILE_TYPE
FILE_TYPE
are used to indicate file types.
public static final int FILE_STRUCTURE
_STRUCTURE are used to indicate file structure for
file transfers.
public static final int IMAGE_FILE_TYPE
FILE_TYPE are used to
indicate file types.
public static final int LOCAL_FILE_TYPE
FILE_TYPE are used to indicate file types.
public static final int NON_PRINT_TEXT_FORMAT
TEXT_FORMAT are used to indicate
text formatting for text transfers (both ASCII and EBCDIC).
public static final int PAGE_STRUCTURE
_STRUCTURE are used to indicate file structure for file
transfers.
public static final int RECORD_STRUCTURE
_STRUCTURE
are used to indicate file structure for file transfers.
public static final int STREAM_TRANSFER_MODE
TRANSFER_MODE are used to indicate file transfer
modes.
public static final int TELNET_TEXT_FORMAT
TEXT_FORMAT are used to indicate
text formatting for text transfers (both ASCII and EBCDIC).
protected ProtocolCommandSupport _commandSupport_
public FTP()
DEFAULT_PORT and initializes internal data structures
for saving FTP reply information.
protected void _connectAction_()
public int abor()
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. - If an I/O error occurs while either sending the
command or receiving the server reply.public int acct(String account)
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. - If an I/O error occurs while either sending the
command or receiving the server reply.public void addProtocolCommandListener(ProtocolCommandListener listener)
public int allo(int bytes)
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. - If an I/O error occurs while either sending the
command or receiving the server reply.public int allo(int bytes, int recordSize)
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. - If an I/O error occurs while either sending the
command or receiving the server reply.public int appe(String pathname)
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. - If an I/O error occurs while either sending the
command or receiving the server reply.public int cdup()
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. - If an I/O error occurs while either sending the
command or receiving the server reply.public int cwd(String directory)
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. - If an I/O error occurs while either sending the
command or receiving the server reply.public int dele(String pathname)
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. - If an I/O error occurs while either sending the
command or receiving the server reply.public void disconnect()
- If an error occurs while disconnecting.public int getReply()
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. - If an I/O error occurs while receiving the
server reply.public int getReplyCode()
connect is of type void.
public String getReplyString()
public String[] getReplyStrings()
public int help()
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. - If an I/O error occurs while either sending the
command or receiving the server reply.public int help(String command)
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. - If an I/O error occurs while either sending the
command or receiving the server reply.public int list()
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. - If an I/O error occurs while either sending the
command or receiving the server reply.public int list(String pathname)
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. - If an I/O error occurs while either sending the
command or receiving the server reply.public int mkd(String pathname)
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. - If an I/O error occurs while either sending the
command or receiving the server reply.public int mode(int mode)
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. - If an I/O error occurs while either sending the
command or receiving the server reply.public int nlst()
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. - If an I/O error occurs while either sending the
command or receiving the server reply.public int nlst(String pathname)
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. - If an I/O error occurs while either sending the
command or receiving the server reply.public int noop()
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. - If an I/O error occurs while either sending the
command or receiving the server reply.public int pass(String password)
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. - If an I/O error occurs while either sending the
command or receiving the server reply.public int pasv()
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. - If an I/O error occurs while either sending the
command or receiving the server reply.public int port(InetAddress host, int port)
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. - If an I/O error occurs while either sending the
command or receiving the server reply.public int pwd()
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. - If an I/O error occurs while either sending the
command or receiving the server reply.public int quit()
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. - If an I/O error occurs while either sending the
command or receiving the server reply.public int rein()
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. - If an I/O error occurs while either sending the
command or receiving the server reply.public void removeProtocolCommandistener(ProtocolCommandListener listener)
public int rest(String marker)
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. - If an I/O error occurs while either sending the
command or receiving the server reply.public int retr(String pathname)
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. - If an I/O error occurs while either sending the
command or receiving the server reply.public int rmd(String pathname)
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. - If an I/O error occurs while either sending the
command or receiving the server reply.public int rnfr(String pathname)
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. - If an I/O error occurs while either sending the
command or receiving the server reply.public int rnto(String pathname)
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. - If an I/O error occurs while either sending the
command or receiving the server reply.public int sendCommand(String command)
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. - If an I/O error occurs while either sending the
command or receiving the server reply.public int sendCommand(String command, String args)
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. - If an I/O error occurs while either sending the
command or receiving the server reply.public int sendCommand(int command)
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. - If an I/O error occurs while either sending the
command or receiving the server reply.public int sendCommand(int command, String args)
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. - If an I/O error occurs while either sending the
command or receiving the server reply.public int site(String parameters)
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. - If an I/O error occurs while either sending the
command or receiving the server reply.public int smnt(String dir)
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. - If an I/O error occurs while either sending the
command or receiving the server reply.public int stat()
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. - If an I/O error occurs while either sending the
command or receiving the server reply.public int stat(String pathname)
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. - If an I/O error occurs while either sending the
command or receiving the server reply.public int stor(String pathname)
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. - If an I/O error occurs while either sending the
command or receiving the server reply.public int stou()
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. - If an I/O error occurs while either sending the
command or receiving the server reply.public int stou(String pathname)
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. - If an I/O error occurs while either sending the
command or receiving the server reply.public int stru(int structure)
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. - If an I/O error occurs while either sending the
command or receiving the server reply.public int syst()
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. - If an I/O error occurs while either sending the
command or receiving the server reply.public int type(int fileType)
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. - If an I/O error occurs while either sending the
command or receiving the server reply.public int type(int fileType, int formatOrByteSize)
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. - If an I/O error occurs while either sending the
command or receiving the server reply.public int user(String username)
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. - If an I/O error occurs while either sending the
command or receiving the server reply.
FTPConectionClosedExceptionis a subclass ofIOExceptionand therefore need not be caught separately, but if you are going to catch it separately, its catch block must appear before the more generalIOExceptioncatch 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.