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
-
FTP()
- Construct an instance of FTP class and sets the default values
for port and protocol name.
-
changeCurrentDirectory(String)
- Change to the directory specified
-
closeConnection()
- Closes an open connection to an FTP server.
-
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.
-
createDirectory(String)
- Creates a directory at the FTP server.
-
deleteFile(String)
- Deletes a file on the FTP server.
-
getLastReply()
- Gets the complete descriptive reply of the server for the last
command sent to the server.
-
getStatus()
- Gets the status of the last command sent to FTP server.
-
putFile(String, String, int, boolean)
- Stores a file to the FTP server from the local machine.
-
removeDirectory(String)
- Removes a directory from the FTP server.
-
renameFile(String, String)
- Renames a remote file at the FTP server.
-
retrieveCurrentDirectory()
- Retrieves the current directory name from the FTP server.
-
retrieveDirectoryListing(String)
- Retrieves a long directory listing from the FTP Server.
-
retrieveFile(String, String, int, boolean)
- Retrieves a file from the FTP server to the local machine.
-
setProtocolName(String)
- Sets the protocol name.
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.
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
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
getLastReply
public String getLastReply()
- Gets the complete descriptive reply of the server for the last
command sent to the server.
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.
closeConnection
public boolean closeConnection()
- Closes an open connection to an FTP server.
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.
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:
-
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:
-
deleteFile
public boolean deleteFile(String fileName)
- Deletes a file on the FTP server.
- Parameters:
- fileName - String defining the remote file to be deleted.
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.
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.
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.
retrieveCurrentDirectory
public String retrieveCurrentDirectory()
- Retrieves the current directory name from the FTP server.
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