|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnu.staldal.ftp.FTPClient
public class FTPClient
An FTP client. See RFC-959. Pathnames must be specified using '/' for directory separator. Passive mode will be used for all transfers. Not thread-safe, i.e. you cannot start a new file while another one is in progress. Note: This class will transmit password in clear text over the network.
| Constructor Summary | |
|---|---|
FTPClient(java.lang.String host,
int port,
java.lang.String username,
java.lang.String password,
java.lang.String path)
Connect to an FTP server and login. |
|
FTPClient(java.lang.String url,
java.lang.String password)
Connect to an FTP server and login. |
|
| Method Summary | |
|---|---|
java.io.OutputStream |
append(java.lang.String pathname)
Create a new file, or append to an existing file. |
java.io.OutputStream |
append(java.lang.String pathname,
boolean last)
Create a new file, or append to an existing file. |
void |
close()
Logout and disconnect from the FTP server. |
boolean |
deleteFile(java.lang.String pathname)
Deletes a file. |
java.io.OutputStream |
store(java.lang.String pathname)
Create a new file, or overwrite an existing file. |
java.io.OutputStream |
store(java.lang.String pathname,
boolean last)
Create a new file, or overwrite an existing file. |
java.io.OutputStream |
storeUnique(java.lang.String path)
Create a new file with an unique name. |
java.io.OutputStream |
storeUnique(java.lang.String path,
boolean last)
Create a new file with an unique name. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public FTPClient(java.lang.String url,
java.lang.String password)
throws java.net.MalformedURLException,
java.net.UnknownHostException,
FTPAuthenticationException,
FTPException,
java.io.IOException
url - an URL specifying host, port, username and optionally
an initial path to change topassword - the password to use for logging in
java.net.MalformedURLException - if there are any syntactic error in the URL
java.net.UnknownHostException - if the hostname specified doesn't exist
FTPAuthenticationException - if the password is wrong
FTPException - if any FTP protocol error occurs
java.io.IOException - if any other IO error occurs
public FTPClient(java.lang.String host,
int port,
java.lang.String username,
java.lang.String password,
java.lang.String path)
throws java.net.UnknownHostException,
FTPAuthenticationException,
FTPException,
java.io.IOException
host - the host to connect to, may be a domain name or IP addressport - the control channel port (default 21)username - the username to use for logging inpassword - the password to use for logging inpath - initial path, realtive to home directory unless starting with '/',
may be null to use home directory
java.net.UnknownHostException - if the hostname specified doesn't exist
FTPAuthenticationException - if the password is wrong
FTPException - if any FTP protocol error occurs
java.io.IOException - if any other IO error occurs| Method Detail |
|---|
public void close()
throws java.io.IOException
java.io.IOException
public java.io.OutputStream store(java.lang.String pathname)
throws FTPException,
java.io.IOException
pathname - path to the file
FTPException - if any FTP protocol error occurs
java.io.IOException - if any other IO error occurs
public java.io.OutputStream store(java.lang.String pathname,
boolean last)
throws FTPException,
java.io.IOException
pathname - path to the filelast - close the FTPClient after transferring this file
FTPException - if any FTP protocol error occurs
java.io.IOException - if any other IO error occurs
public java.io.OutputStream append(java.lang.String pathname)
throws FTPException,
java.io.IOException
pathname - path to the file
FTPException - if any FTP protocol error occurs
java.io.IOException - if any other IO error occurs
public java.io.OutputStream append(java.lang.String pathname,
boolean last)
throws FTPException,
java.io.IOException
pathname - path to the filelast - close the FTPClient after transferring this file
FTPException - if any FTP protocol error occurs
java.io.IOException - if any other IO error occurs
public java.io.OutputStream storeUnique(java.lang.String path)
throws FTPException,
java.io.IOException
path - path to the file, must end with '/' or be empty
FTPException - if any FTP protocol error occurs
java.io.IOException - if any other IO error occurs
public java.io.OutputStream storeUnique(java.lang.String path,
boolean last)
throws FTPException,
java.io.IOException
path - path to the file, must end with '/' or be emptylast - close the FTPClient after transferring this file
FTPException - if any FTP protocol error occurs
java.io.IOException - if any other IO error occurs
public boolean deleteFile(java.lang.String pathname)
throws FTPException,
java.io.IOException
pathname - path to the file
FTPException - if any FTP protocol error occurs
java.io.IOException - if any other IO error occurs
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||