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.
-
FTPClient()
- Empty default constructor.
-
FTPClient(String)
- Constructs a FTP session.
-
FTPClient(String, int)
- Constructs a FTP session.
-
changeDirectory(String)
- Change to a remote directory.
-
createDirectory(String)
- Create a directory on the server.
-
currentDirectory()
- Retrieve the current directory.
-
deleteDirectory(String)
- Delete a remote directory.
-
deleteFile(String)
-
-
enterPassiveMode()
- Enter passive mode.
-
logoff()
- Logoff FTP server.
-
logon(String, String)
- Logon to FTP server.
-
logon(String, String, String)
- Logon to FTP server.
-
parentDirectory()
- Change to parent directory.
-
renameFile(String, String)
-
-
reset()
- Reset session and log off.
-
retrieveDirectory()
- Retieve directory of files from the current remote directory.
-
retrieveDirectory(String)
- Retieve directory of files from a remote directory.
-
retrieveFile(String, char)
- Retrieve a file of specified.
-
retrieveFile(String, String, char)
- Retrieve a specified file by type into a local file.
-
retrieveList()
- Retieve list of files from the current remote directory.
-
retrieveList(String)
- Retieve list of files from a remote directory.
-
storeFile(String, char)
- Store a local file on the server.
-
storeFile(String, String, char)
- Store a local file on the server with a new remote file name.
-
transfer(InputStream, OutputStream, char)
- Transfer data from a source stream to destination stream.
FTPClient
public FTPClient()
- Empty default constructor.
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
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
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
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
logoff
public void logoff() throws IOException
- Logoff FTP server.
- Throws: IOException
- Could not logoff
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
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
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
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
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
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
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
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
deleteFile
public void deleteFile(String remoteFile) throws IOException
renameFile
public void renameFile(String oldName,
String newName) throws IOException
currentDirectory
public String currentDirectory() throws IOException
- Retrieve the current directory.
- Returns:
- A string containing the directory name
- Throws: IOException
- Could not retrieve current directory
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
parentDirectory
public void parentDirectory() throws IOException
- Change to parent directory.
- Throws: IOException
- Could not change from current directory
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
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
reset
public void reset() throws IOException
- Reset session and log off.
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.
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