All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class COM.ibm.net.FTPClient

java.lang.Object
   |
   +----COM.ibm.net.InetProtocolClient
           |
           +----COM.ibm.net.FTPClient

public class FTPClient
extends InetProtocolClient
Implements a File Transfer Protocol (RFC 959) client.

Internally supported FTP commands:
USER PASS ACCT CWD CDUP REIN QUIT PASV TYPE(A,I) STRU(F) MODE(S) RETR STOR RNFR RNTO DELE RMD MKD PWD LIST NLST

Unsupported commands:
SMNT PORT TYPE(E,L) STRU(R,P) MODE(B,C) STOU APPE ALLO REST ABOR SITE SYST STAT HELP NOOP

 Copyright (c) Taligent, Inc.  1996 - 1997.
 Copyright (c) IBM Corporation 1996 - 1997.
 All Rights Reserved.
 


Constructor Index

 o FTPClient()
Empty default constructor.
 o FTPClient(String)
Constructs a FTP session.
 o FTPClient(String, int)
Constructs a FTP session.

Method Index

 o changeDirectory(String)
Change to a remote directory.
 o createDirectory(String)
Create a directory on the server.
 o currentDirectory()
Retrieve the current directory.
 o deleteDirectory(String)
Delete a remote directory.
 o deleteFile(String)
 o enterPassiveMode()
Enter passive mode.
 o logoff()
Logoff FTP server.
 o logon(String, String)
Logon to FTP server.
 o logon(String, String, String)
Logon to FTP server.
 o parentDirectory()
Change to parent directory.
 o renameFile(String, String)
 o reset()
Reset session and log off.
 o retrieveDirectory()
Retieve directory of files from the current remote directory.
 o retrieveDirectory(String)
Retieve directory of files from a remote directory.
 o retrieveFile(String, char)
Retrieve a file of specified.
 o retrieveFile(String, String, char)
Retrieve a specified file by type into a local file.
 o retrieveList()
Retieve list of files from the current remote directory.
 o retrieveList(String)
Retieve list of files from a remote directory.
 o storeFile(String, char)
Store a local file on the server.
 o storeFile(String, String, char)
Store a local file on the server with a new remote file name.
 o transfer(InputStream, OutputStream, char)
Transfer data from a source stream to destination stream.

Constructors

 o FTPClient
 public FTPClient()
Empty default constructor.

 o FTPClient
 public FTPClient(String fileServ)
Constructs a FTP session. FTPClient uses port 21 by default.

Parameters:
fileServ - Name or IP address of a file server
 o FTPClient
 public FTPClient(String fileServ,
                  int port)
Constructs a FTP session.

Parameters:
fileServ - Name or IP address of a file server
port - Port number on file server

Methods

 o logon
 public void logon(String user,
                   String password) throws IOException
Logon to FTP server.

Parameters:
user - Logon user name
password - Logon password
Throws: IOException
Could not logon
 o logon
 public void logon(String user,
                   String password,
                   String acct) throws IOException
Logon to FTP server.

Parameters:
user - Logon user name
password - Logon password
acct - Logon account
Throws: IOException
Could not logon
 o logoff
 public void logoff() throws IOException
Logoff FTP server.

Throws: IOException
Could not logoff
 o retrieveFile
 public void retrieveFile(String remoteFile,
                          char type) throws IOException
Retrieve a file of specified. The local file will have the same name as the remote file.

Parameters:
remoteFile - Name of file on the server
type - Transfer type 'A' or 'I' (ASCII or image/binary)
Throws: IOException
Could not retrieve file from the server
 o retrieveFile
 public void retrieveFile(String remoteFile,
                          String localFile,
                          char type) throws IOException
Retrieve a specified file by type into a local file.

Parameters:
remoteFile - Name of file on the server
localFile - Name of local file
type - Transfer type 'A' or 'I' (ASCII or image/binary)
Throws: IOException
Could not retrieve file from the server
 o storeFile
 public void storeFile(String localFile,
                       char type) throws IOException
Store a local file on the server.

Parameters:
localFile - Name of the local file
type - Transfer type 'A' or 'I' (ASCII or image/binary)
Throws: IOException
Could not send file to the server
 o storeFile
 public void storeFile(String localFile,
                       String remoteFile,
                       char type) throws IOException
Store a local file on the server with a new remote file name.

Parameters:
localFile - Name of the local file
remoteFile - Name of the remote file
type - Transfer type 'A' or 'I' (ASCII or image/binary)
Throws: IOException
Could not send file to the server
 o retrieveDirectory
 public String[] retrieveDirectory() throws IOException
Retieve directory of files from the current remote directory.

Returns:
A string array; each element contains a file name
Throws: IOException
Could not retrieve directory from the server
 o retrieveDirectory
 public String[] retrieveDirectory(String remoteDir) throws IOException
Retieve directory of files from a remote directory.

Parameters:
remoteDir - Name of the directory on the server
Returns:
A string array; each element contains a file name
Throws: IOException
Could not retrieve directory from the server
 o retrieveList
 public String[] retrieveList() throws IOException
Retieve list of files from the current remote directory.

Returns:
A string array; each element contains a file name
Throws: IOException
Could not retrieve file list from the server
 o retrieveList
 public String[] retrieveList(String remoteDir) throws IOException
Retieve list of files from a remote directory.

Parameters:
remoteDir - Name of the directory on the server
Returns:
A string array; each element contains a file name
Throws: IOException
Could not retrieve file list from the server
 o deleteFile
 public void deleteFile(String remoteFile) throws IOException
 o renameFile
 public void renameFile(String oldName,
                        String newName) throws IOException
 o currentDirectory
 public String currentDirectory() throws IOException
Retrieve the current directory.

Returns:
A string containing the directory name
Throws: IOException
Could not retrieve current directory
 o changeDirectory
 public void changeDirectory(String remoteDir) throws IOException
Change to a remote directory.

Parameters:
remoteDir - Name of the directory on the server
Throws: IOException
Could not change from current directory
 o parentDirectory
 public void parentDirectory() throws IOException
Change to parent directory.

Throws: IOException
Could not change from current directory
 o deleteDirectory
 public void deleteDirectory(String remoteDir) throws IOException
Delete a remote directory.

Parameters:
remoteDir - Name of the directory on the server
Throws: IOException
Could not delete directory
 o createDirectory
 public void createDirectory(String remoteDir) throws IOException
Create a directory on the server.

Parameters:
remoteDir - Name of the directory on the server
Throws: IOException
Could not create directory
 o reset
 public void reset() throws IOException
Reset session and log off.

 o enterPassiveMode
 protected Socket enterPassiveMode() throws IOException
Enter passive mode. This causes the server to create a socket for data transfer.

Returns:
A local socket for data transfer.
 o transfer
 protected void transfer(InputStream in,
                         OutputStream out,
                         char type) throws IOException
Transfer data from a source stream to destination stream. ASCII or image/binary mode are supported.

Parameters:
in - Source input stream
out - Destination output stream
type - File transfer type 'A' or 'I'
Throws: IOException
Could not transfer data

All Packages  Class Hierarchy  This Package  Previous  Next  Index