Save This Page
Home » edtftpj » com.enterprisedt.net.ftp » [javadoc | source]
com.enterprisedt.net.ftp
public class: FTPClient [javadoc | source]
java.lang.Object
   com.enterprisedt.net.ftp.FTPClient
Supports client-side FTP. Most common FTP operations are present in this class.
Constructor:
 public FTPClient(String remoteHost) throws IOException, FTPException 
    Constructor. Creates the control socket
    Parameters:
    remoteHost - the remote hostname
 public FTPClient(InetAddress remoteAddr) throws IOException, FTPException 
    Constructor. Creates the control socket
    Parameters:
    remoteAddr - the address of the remote host
 public FTPClient(String remoteHost,
    int controlPort) throws IOException, FTPException 
    Constructor. Creates the control socket
    Parameters:
    remoteHost - the remote hostname
    controlPort - port for control stream
 public FTPClient(InetAddress remoteAddr,
    int controlPort) throws IOException, FTPException 
    Constructor. Creates the control socket. Allows setting of control port (normally set by default to 21).
    Parameters:
    remoteAddr - the address of the remote host
    controlPort - port for control stream
Method from com.enterprisedt.net.ftp.FTPClient Summary:
chdir,   debugResponses,   delete,   dir,   dir,   get,   get,   get,   getFileSize,   getRemoteHostName,   getType,   initSOCKS,   list,   list,   login,   mkdir,   password,   put,   put,   put,   put,   pwd,   quit,   quote,   rename,   rmdir,   setConnectMode,   setTimeout,   setType,   site,   system,   user
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from com.enterprisedt.net.ftp.FTPClient Detail:
 public  void chdir(String dir) throws IOException, FTPException 
    Change the remote working directory to that supplied
 public  void debugResponses(boolean on) 
    Switch debug of responses on or off
 public  void delete(String remoteFile) throws IOException, FTPException 
    Delete the specified remote file
 public String[] dir(String mask) throws IOException, FTPException 
    List a directory's contents as an array of strings of filenames.
 public String[] dir(String mask,
    boolean full) throws IOException, FTPException 
    List a directory's contents as an array of strings. A detailed listing is available, otherwise just filenames are provided. The detailed listing varies in details depending on OS and FTP server.
 public byte[] get(String remoteFile) throws IOException, FTPException 
    Get data from the FTP server. Transfers in whatever mode we are in. Retrieve as a byte array. Note that we may experience memory limitations as the entire file must be held in memory at one time.
 public  void get(String localPath,
    String remoteFile) throws IOException, FTPException 
    Get data from the FTP server. Uses the currently set transfer mode.
 public InputStream get(String remoteFile,
    long byteSkip) throws IOException, FTPException 
    Get data from the FTP server. Transfers in whatever mode we are in. Returns the InputStream for the FTP connection.
 public int getFileSize(String remoteFile) throws IOException, FTPException 
 String getRemoteHostName() 
    Get the name of the remote host
 public FTPTransferType getType() 
    Get the current transfer type
 public  void initSOCKS(String port,
    String host) 
    Set up SOCKS v4 proxy settings. This can be used if there is a SOCKS proxy server in place that must be connected thru.
 public String list(String mask) throws IOException, FTPException 
Deprecated! As - of FTP 1.1, replaced by #dir(String)

    List a directory's contents
 public String list(String mask,
    boolean full) throws IOException, FTPException 
Deprecated! As - of FTP 1.1, replaced by #dir(String,boolean)

    List a directory's contents as one string. A detailed listing is available, otherwise just filenames are provided. The detailed listing varies in details depending on OS and FTP server.
 public  void login(String user,
    String password) throws IOException, FTPException 
    Login into an account on the FTP server. This call completes the entire login process
 public  void mkdir(String dir) throws IOException, FTPException 
    Create the specified remote working directory
 public  void password(String password) throws IOException, FTPException 
    Supplies the password for a previously supplied username to log into the FTP server. Must be preceeded by the user() method
 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.
 public  void put(byte[] bytes,
    String remoteFile) throws IOException, FTPException 
    Put data onto the FTP server. It is placed in the current directory.
 public  void put(String localPath,
    String remoteFile,
    boolean append) throws IOException, FTPException 
    Put a local file onto the FTP server. It is placed in the current directory. Allows appending if current file exists
 public  void put(byte[] bytes,
    String remoteFile,
    boolean append) throws IOException, FTPException 
    Put data onto the FTP server. It is placed in the current directory. Allows appending if current file exists
 public String pwd() throws IOException, FTPException 
    Get the current remote working directory
 public  void quit() throws IOException, FTPException 
    Quit the FTP session
 public  void quote(String command,
    String[] validCodes) throws IOException, FTPException 
    Issue arbitrary ftp commands to the FTP server.
 public  void rename(String from,
    String to) throws IOException, FTPException 
    Rename a file or directory
 public  void rmdir(String dir) throws IOException, FTPException 
    Delete the specified remote working directory
 public  void setConnectMode(FTPConnectMode mode) 
    Set the connect mode
 public  void setTimeout(int millis) throws IOException 
    Set the TCP timeout on the underlying socket. If a timeout is set, then any operation which takes longer than the timeout value will be killed with a java.io.InterruptedException. We set both the control and data connections
 public  void setType(FTPTransferType type) throws IOException, FTPException 
    Set the transfer type
 public boolean site(String command) throws IOException, FTPException 
    Run a site-specific command on the server. Support for commands is dependent on the server
 public String system() throws IOException, FTPException 
    Get the type of the OS at the server
 public  void user(String user) throws IOException, FTPException 
    Supply the user name to log into an account on the FTP server. Must be followed by the password() method - but we allow for