Libraries anvil net FtpClient

class FtpClient
extends anvil.lang.object
Embedded FTP client.

Constructor
FtpClient( [string host, int port] )
FtpClient( [InetAddress host, int port] )
Creates and returns FtpClient. Optionally opens connection to given host and port. If error occured null is returned.
Throws IOError -  if an IO error occured


Methods

OutputStream append(string fileName)
Appends to a file in server and returns output stream to write to
Returns output stream
Throws IOError -  If operation failed

boolean asc()
Sets transfer type to 'A'.
Throws IOError -  If operation failed

boolean bin()
Sets transfer type to 'B'.
Throws IOError -  If operation failed

void cd(string dir)
Changes remote directory.
Parameters dir -  remote directory
Throws IOError -  If operation failed

void cdUp()
Moves to parent directory.
Throws IOError -  If operation failed

boolean close()
Closes connection.
Returns true if ok
Throws IOError -  If operation failed

InputStream get(string fileName)
Gets and returns the input stream to given file. Returned stream should not be closed because that will close the connection as well.
Parameters fileName -  file name
Returns input stream to given file
Throws IOError -  if error occurred

boolean isOpen()
Checks if connection is open.

InputStream list()
Lists files (and information in current remote directory.
Returns InputStream containing directory list
Throws IOError -  If operation failed

boolean login(string username, string password)
Logs into server with given 'username' and 'password'.
Parameters username - 
password - 
Throws IOError -  if login was not succesful

boolean open(string host)
boolean open(string host, int port )
Opens connection to given 'host' (and 'port').
Parameters host -  host name
port -  port number
Throws IOError -  If operation failed
AccessDenied -  If security policy denies this operation

OutputStream put(string fileName)
Puts a file into server and returns output stream to write to
Returns output stream
Throws IOError -  If operation failed

string pwd()
Returns the current directory.
Throws IOError -  If operation failed

void rename(string oldName, string newName)
Renames a file in server.
Throws IOError -  If operation failed