All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.enterprisedt.net.ftp.FTPClient

java.lang.Object
   |
   +----com.enterprisedt.net.ftp.FTPClient

public class FTPClient
extends Object
Supports client-side FTP. Most common FTP operations are present in this class. Lots to do, but works ok.

Author:
Bruce Blackshaw

Variable Index

 o control
Socket responsible for controlling the connection
 o data
Socket responsible for transferring the data
 o transferType
Record of the transfer type

Constructor Index

 o FTPClient(InetAddress)
Constructor.
 o FTPClient(String)
Constructor.

Method Index

 o chdir(String)
Change the remote working directory to that supplied
 o delete(String)
Delete the specified remote file
 o get(String)
Get data from the FTP server.
 o get(String, String)
Get data from the FTP server.
 o getType()
Get the current transfer type
 o login(String, String)
Login into an account on the FTP server
 o mkdir(String)
Create the specified remote working directory
 o put(byte[], String)
Put data onto the FTP server.
 o put(String, String)
Put a local file onto the FTP server.
 o quit()
Quit the FTP session
 o rmdir(String)
Delete the specified remote working directory
 o setType(FTPTransferType)
Delete the specified remote file

Variables

 o control
 private FTPControlSocket control
Socket responsible for controlling the connection

 o data
 private Socket data
Socket responsible for transferring the data

 o transferType
 private FTPTransferType transferType
Record of the transfer type

Constructors

 o FTPClient
 public FTPClient(String remoteHost) throws IOException, FTPException
Constructor. Creates the control socket

Parameters:
remoteHost - the remote hostname
 o FTPClient
 public FTPClient(InetAddress remoteAddr) throws IOException, FTPException
Constructor. Creates the control socket

Parameters:
remoteAddr - the address of the remote host

Methods

 o login
 public void login(String user,
                   String password) throws IOException, FTPException
Login into an account on the FTP server

Parameters:
user - user name
password - user's password
 o put
 public void put(String localPath,
                 String remoteFile) throws IOException, FTPException
Put a local file onto the FTP server. It is placed in the current directory.

Parameters:
localPath - path of the local file
remoteFile - name of remote file in current directory
 o put
 public void put(byte bytes[],
                 String remoteFile) throws IOException, FTPException
Put data onto the FTP server. It is placed in the current directory.

Parameters:
data - array of bytes
remoteFile - name of remote file in current directory
 o get
 public void get(String localPath,
                 String remoteFile) throws IOException, FTPException
Get data from the FTP server. Uses the currently set transfer mode.

Parameters:
localPath - local file to put data in
remoteFile - name of remote file in current directory
 o get
 public byte[] get(String remoteFile) throws IOException, FTPException
Get data from the FTP server. Uses the currently set transfer mode. Retrieve as a byte array. Note that we may experience memory limitations as the entire file must be held in memory at one time.

Parameters:
remoteFile - name of remote file in current directory
 o getType
 public FTPTransferType getType()
Get the current transfer type

Parameters:
dir - name of remote file to delete
 o setType
 public void setType(FTPTransferType type) throws IOException, FTPException
Delete the specified remote file

Parameters:
dir - name of remote file to delete
 o delete
 public void delete(String remoteFile) throws IOException, FTPException
Delete the specified remote file

Parameters:
dir - name of remote file to delete
 o rmdir
 public void rmdir(String dir) throws IOException, FTPException
Delete the specified remote working directory

Parameters:
dir - name of remote directory to delete
 o mkdir
 public void mkdir(String dir) throws IOException, FTPException
Create the specified remote working directory

Parameters:
dir - name of remote directory to create
 o chdir
 public void chdir(String dir) throws IOException, FTPException
Change the remote working directory to that supplied

Parameters:
dir - name of remote directory to change to
 o quit
 public void quit() throws IOException, FTPException
Quit the FTP session


All Packages  Class Hierarchy  This Package  Previous  Next  Index