Class powersoft.jcm.net.FTP
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class powersoft.jcm.net.FTP

java.lang.Object
   |
   +----powersoft.jcm.net.Internet
           |
           +----powersoft.jcm.net.FTP

public class FTP
extends Internet
implements FTPInterface
The FTP Class is drived from Internet class. It allows the most common functionalities of FTP protocol. All the constants are defined in FTPInterface Class.
See Also:
Internet, FTPInterface

Constructor Index

 o FTP()
Construct an instance of FTP class and sets the default values for port and protocol name.

Method Index

 o changeCurrentDirectory(String)
Change to the directory specified
 o closeConnection()
Closes an open connection to an FTP server.
 o connect()
Connects to an FTP server and log on as the user defined by the property setUserName using the password defined be the property setPassword.
 o createDirectory(String)
Creates a directory at the FTP server.
 o deleteFile(String)
Deletes a file on the FTP server.
 o getLastReply()
Gets the complete descriptive reply of the server for the last command sent to the server.
 o getStatus()
Gets the status of the last command sent to FTP server.
 o putFile(String, String, int, boolean)
Stores a file to the FTP server from the local machine.
 o removeDirectory(String)
Removes a directory from the FTP server.
 o renameFile(String, String)
Renames a remote file at the FTP server.
 o retrieveCurrentDirectory()
Retrieves the current directory name from the FTP server.
 o retrieveDirectoryListing(String)
Retrieves a long directory listing from the FTP Server.
 o retrieveFile(String, String, int, boolean)
Retrieves a file from the FTP server to the local machine.
 o setProtocolName(String)
Sets the protocol name.

Constructors

 o FTP
  public FTP()
Construct an instance of FTP class and sets the default values for port and protocol name.

Note: The default command port for FTP protocol is 21.

Methods

 o setProtocolName
  public void setProtocolName(String protocol)
Sets the protocol name.

Note: Protocol name for FTP can not be change and the supplied value of the argument will simply be ignored.

Parameters:
protocol - Ignored.
Overrides:
setProtocolName in class Internet
 o getStatus
  public int getStatus()
Gets the status of the last command sent to FTP server. This is a three digit numeric reply from the server about the status of the command sent to the server.

Note: This numeric code is only a part of the reply sent from the host.

See Also:
getLastReply
 o getLastReply
  public String getLastReply()
Gets the complete descriptive reply of the server for the last command sent to the server.
 o connect
  public boolean connect()
Connects to an FTP server and log on as the user defined by the property setUserName using the password defined be the property setPassword.
 o closeConnection
  public boolean closeConnection()
Closes an open connection to an FTP server.
 o retrieveDirectoryListing
  public Vector retrieveDirectoryListing(String currentDirectory)
Retrieves a long directory listing from the FTP Server.

Note: Opens an appropriate passive or active connection to the FTP server.

Parameters:
currentDirectory - String specifing the name of the current directory.
 o retrieveFile
  public boolean retrieveFile(String remoteFileName,
                              String localFileName,
                              int transferType,
                              boolean failIfFileExists)
Retrieves a file from the FTP server to the local machine.

Note: Opens an appropriate passive or active connection to the FTP server.

Parameters:
remoteFileName - String defining the name of the remote file to be down loaded.
localFileName - String defining the name for the local file to be created.
transferType - Specifies the transfer type e.g. ASCII, binary etc.
failIfFileExists - boolean to define that the local file should be overriden or transfer will fail if a local file with the same name exists.
See Also:
 o putFile
  public boolean putFile(String localFileName,
                         String remoteFileName,
                         int transferType,
                         boolean overrideRemoteFile)
Stores a file to the FTP server from the local machine.

Note: Open an appropriate passive or active connection to the FTP server.

Parameters:
localFileName - String defining the name of the local file to be up loaded.
remoteFileName - String defining the name for the remote file to be created at the server.
transferType - Specifies the transfer type e.g. ASCII, binary etc.
overrideRemoteFile - boolean to define that the remote file should be overriden or a file with the unique name should be created.
See Also:
 o deleteFile
  public boolean deleteFile(String fileName)
Deletes a file on the FTP server.
Parameters:
fileName - String defining the remote file to be deleted.
 o renameFile
  public boolean renameFile(String oldFileName,
                            String newFileName)
Renames a remote file at the FTP server.
Parameters:
oldFileName - String defining the name of the file to be rename.
newFileName - String defining the new name for the file to be renamed.
 o createDirectory
  public boolean createDirectory(String directoryName)
Creates a directory at the FTP server.
Parameters:
directoryName - String containing the name of the directory to be created.
 o removeDirectory
  public boolean removeDirectory(String directoryName)
Removes a directory from the FTP server.
Parameters:
directoryName - String to define the name of the directory to be deleted.
 o retrieveCurrentDirectory
  public String retrieveCurrentDirectory()
Retrieves the current directory name from the FTP server.
 o changeCurrentDirectory
  public boolean changeCurrentDirectory(String directoryName)
Change to the directory specified
Parameters:
diretoryName - String defining the path

All Packages  Class Hierarchy  This Package  Previous  Next  Index