java.lang.Object | |||
↳ | sun.net.NetworkClient | ||
↳ | sun.net.TransferProtocolClient | ||
↳ | sun.net.ftp.FtpClient |
This class implements the FTP client.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | FTP_PORT |
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
welcomeMsg | Welcome message from the server, if any. |
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
New FTP client connected to host host.
| |||||||||||
New FTP client connected to host host, port port.
| |||||||||||
Create an uninitialized FTP client.
| |||||||||||
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Append to a file on the FTP server
| |||||||||||
Set transfer type to 'A'
| |||||||||||
Set transfer type to 'I'
| |||||||||||
CD to a specific directory on a remote FTP server
| |||||||||||
CD to the parent directory on a remote FTP server
| |||||||||||
issue the QUIT command to the FTP server and close the connection.
| |||||||||||
GET a file from the FTP server
| |||||||||||
LIST files in the current directory on a remote FTP server
| |||||||||||
login user to a host with username user and password
password
| |||||||||||
List (NLST) file names on a remote FTP server
| |||||||||||
Send a No-operation command.
| |||||||||||
Open a FTP connection to host host.
| |||||||||||
Open a FTP connection to host host on port port.
| |||||||||||
PUT a file to the FTP server
| |||||||||||
Print working directory of remote FTP server
| |||||||||||
Reinitialize the USER parameters on the FTp server
| |||||||||||
Rename a file on the ftp server
| |||||||||||
Get the "System string" from the FTP server
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.
| |||||||||||
Send a command to the FTP server.
| |||||||||||
Send a command to the FTP server and check for success.
| |||||||||||
Tries to open a Data Connection with the server.
| |||||||||||
Tries to open a Data Connection in "PASSIVE" mode by issuing a EPSV or
PASV command then opening a Socket to the specified address & port
| |||||||||||
Read the reply from the FTP server.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() | |||||||||||
![]() |
New FTP client connected to host host.
host | Hostname of the FTP server |
---|
FtpProtocolException | if the connection fails |
---|---|
IOException |
New FTP client connected to host host, port port.
host | Hostname of the FTP server |
---|---|
port | port number to connect to (usually 21) |
FtpProtocolException | if the connection fails |
---|---|
IOException |
Create an uninitialized FTP client.
Append to a file on the FTP server
filename | name of the file to append to |
---|
OutputStream
to write the file to
IOException |
---|
Set transfer type to 'A'
FtpProtocolException | if the command fails |
---|---|
IOException |
Set transfer type to 'I'
FtpProtocolException | if the command fails |
---|---|
IOException |
CD to a specific directory on a remote FTP server
remoteDirectory | path of the directory to CD to |
---|
IOException |
---|
issue the QUIT command to the FTP server and close the connection.
FtpProtocolException | if an error occured |
---|---|
IOException |
GET a file from the FTP server
filename | name of the file to retrieve |
---|
InputStream
to read the file fromFileNotFoundException | if the file can't be opened |
---|---|
IOException |
LIST files in the current directory on a remote FTP server
InputStream
to read the list from
IOException |
---|
login user to a host with username user and password password
user | Username to use at login |
---|---|
password | Password to use at login or null of none is needed |
FtpLoginException | if login is unsuccesful |
---|---|
IOException |
List (NLST) file names on a remote FTP server
path | pathname to the directory to list, null for current directory |
---|
InputStream
to read the list fromIOException |
---|
Send a No-operation command. It's usefull for testing the connection status
FtpProtocolException | if the command fails |
---|---|
IOException |
Open a FTP connection to host host.
host | The hostname of the ftp server |
---|
FtpProtocolException | if connection fails |
---|---|
IOException |
Open a FTP connection to host host on port port.
host | the hostname of the ftp server |
---|---|
port | the port to connect to (usually 21) |
FtpProtocolException | if connection fails |
---|---|
IOException |
PUT a file to the FTP server
filename | name of the file to store |
---|
OutputStream
to write the file to
IOException |
---|
Print working directory of remote FTP server
FtpProtocolException | if the command fails |
---|---|
IOException |
Reinitialize the USER parameters on the FTp server
FtpProtocolException | if the command fails |
---|---|
IOException |
Rename a file on the ftp server
FtpProtocolException | if the command fails |
---|---|
IOException |
Get the "System string" from the FTP server
FtpProtocolException | if it fails |
---|---|
IOException |
Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.
A subclass overrides the finalize
method to dispose of
system resources or to perform other cleanup.
The general contract of finalize is that it is invoked if and when the JavaTM virtual machine has determined that there is no longer any means by which this object can be accessed by any thread that has not yet died, except as a result of an action taken by the finalization of some other object or class which is ready to be finalized. The finalize method may take any action, including making this object available again to other threads; the usual purpose of finalize, however, is to perform cleanup actions before the object is irrevocably discarded. For example, the finalize method for an object that represents an input/output connection might perform explicit I/O transactions to break the connection before the object is permanently discarded.
The finalize method of class Object performs no special action; it simply returns normally. Subclasses of Object may override this definition.
The Java programming language does not guarantee which thread will invoke the finalize method for any given object. It is guaranteed, however, that the thread that invokes finalize will not be holding any user-visible synchronization locks when finalize is invoked. If an uncaught exception is thrown by the finalize method, the exception is ignored and finalization of that object terminates.
After the finalize method has been invoked for an object, no further action is taken until the Java virtual machine has again determined that there is no longer any means by which this object can be accessed by any thread that has not yet died, including possible actions by other objects or classes which are ready to be finalized, at which point the object may be discarded.
The finalize method is never invoked more than once by a Java virtual machine for any given object.
Any exception thrown by the finalize
method causes
the finalization of this object to be halted, but is otherwise
ignored.
IOException |
---|
Send a command to the FTP server.
cmd | String containing the command |
---|
FtpProtocolException | if an error occured |
---|---|
IOException |
Send a command to the FTP server and check for success.
cmd | String containing the command |
---|
FtpProtocolException | if an error occured |
---|---|
IOException |
Tries to open a Data Connection with the server. It will first try a passive mode connection, then, if it fails, a more traditional PORT command
cmd | the command to execute (RETR, STOR, etc...) |
---|
FtpProtocolException | if an error occurs when issuing the PORT command to the ftp server. |
---|---|
IOException |
Tries to open a Data Connection in "PASSIVE" mode by issuing a EPSV or PASV command then opening a Socket to the specified address & port
FtpProtocolException | if an error occurs when issuing the PASV command to the ftp server. |
---|---|
IOException |
Read the reply from the FTP server.
FtpProtocolException | if an error occured |
---|---|
IOException |