biz.wisesoft.util.ftp
Class FTPClient

java.lang.Object
  extended bybiz.wisesoft.util.ftp.FTPClient

public class FTPClient
extends java.lang.Object


Constructor Summary
FTPClient()
          Constructs an FTP client with default FTP port 21.
 
Method Summary
 void addStatusListener(biz.wisesoft.util.ftp.StatusListener statuslistener)
           
 void changeToParentDirectory()
          Goes back to parent directory
 void changeWorkingDirectory(java.lang.String remotePath)
          Changes the remote path
 boolean connect()
          Connects the ftp server
 void createremoteDirectory(java.lang.String remotePath)
          Creates a path of new remote directory
 void deleteRemoteFile(java.lang.String remotePath)
          Deletes the remote file
 void disconnect()
          Disconnects the ftp server
 void downloadRemoteFile(java.lang.String remotePath, java.lang.String localPath)
          Downloads a file from the ftp server to local
 java.lang.String getCurrentWorkingDirectory()
          Returns the name of current working remote directory
 java.lang.String getFileList()
          Returns a list of files in current working remote directory
 java.lang.String getHostName()
          Returns the name of the ftp servet
 java.lang.String getPassword()
           
 int getPort()
           
 java.lang.String getUserName()
           
 void removeRemoteDirectory(java.lang.String remotePath)
          Removes the remote directory
 void removeStatusListener(biz.wisesoft.util.ftp.StatusListener statuslistener)
           
 void renameRemoteFile(java.lang.String oldPath, java.lang.String newpath)
          Renames the remote file
 void setHostName(java.lang.String host)
          Sets the name of the ftp server
 void setPassword(java.lang.String pwd)
          Sets the password to login into the ftp server
 void setPort(int ftpServerPort)
          Sets the port of the ftp server
 void setUserName(java.lang.String user)
          Sets the username to login into the ftp server
 void uploadLocalFile(java.lang.String remoteFileName, java.lang.String localPath)
          Uploads a local file to the ftp server
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FTPClient

public FTPClient()
Constructs an FTP client with default FTP port 21.

Method Detail

getFileList

public java.lang.String getFileList()
Returns a list of files in current working remote directory

Returns:
The list of files in current working remote directory

setHostName

public void setHostName(java.lang.String host)
Sets the name of the ftp server

Parameters:
host - The name of the ftp server

addStatusListener

public void addStatusListener(biz.wisesoft.util.ftp.StatusListener statuslistener)

changeWorkingDirectory

public void changeWorkingDirectory(java.lang.String remotePath)
Changes the remote path

Parameters:
remotePath - The remote path to change

disconnect

public void disconnect()
Disconnects the ftp server


getPort

public int getPort()
Returns:
The ftp port

getUserName

public java.lang.String getUserName()
Returns:
The username

removeStatusListener

public void removeStatusListener(biz.wisesoft.util.ftp.StatusListener statuslistener)

removeRemoteDirectory

public void removeRemoteDirectory(java.lang.String remotePath)
Removes the remote directory

Parameters:
remotePath - The remote path

downloadRemoteFile

public void downloadRemoteFile(java.lang.String remotePath,
                               java.lang.String localPath)
Downloads a file from the ftp server to local

Parameters:
remotePath - The remote path
localPath - The local path

connect

public boolean connect()
Connects the ftp server

Returns:
Whether successful connects to the ftp server

setPort

public void setPort(int ftpServerPort)
Sets the port of the ftp server

Parameters:
ftpServerPort - The port of the ftp server

deleteRemoteFile

public void deleteRemoteFile(java.lang.String remotePath)
Deletes the remote file

Parameters:
remotePath - The path of the remote file

renameRemoteFile

public void renameRemoteFile(java.lang.String oldPath,
                             java.lang.String newpath)
Renames the remote file

Parameters:
oldPath - The ole path of the remote file
newpath - The new path of the remote file

getCurrentWorkingDirectory

public java.lang.String getCurrentWorkingDirectory()
Returns the name of current working remote directory

Returns:
The name of current working remote directory

uploadLocalFile

public void uploadLocalFile(java.lang.String remoteFileName,
                            java.lang.String localPath)
Uploads a local file to the ftp server

Parameters:
remoteFileName - The remote file name
localPath - The local path

changeToParentDirectory

public void changeToParentDirectory()
Goes back to parent directory


getPassword

public java.lang.String getPassword()
Returns:
The password to login into the ftp server

setPassword

public void setPassword(java.lang.String pwd)
Sets the password to login into the ftp server

Parameters:
pwd - The password to login into the ftp server

setUserName

public void setUserName(java.lang.String user)
Sets the username to login into the ftp server

Parameters:
user - The username to login into the ftp server

getHostName

public java.lang.String getHostName()
Returns the name of the ftp servet

Returns:
The name of the ftp server

createremoteDirectory

public void createremoteDirectory(java.lang.String remotePath)
Creates a path of new remote directory

Parameters:
remotePath - The path of new remote directory