com.mindbright.net.ftp
Interface FTPServerEventHandler

All Known Implementing Classes:
FTPToSFTPProxy, SSH2FTPOverSFTP

public interface FTPServerEventHandler

Interface which describes FTP protocol functions.


Method Summary
 void abort()
           
 void changeDirectory(java.lang.String dir)
          Change current directory on the server.
 void chmod(int mod, java.lang.String file)
          Modify the file permissions.
 void delete(java.lang.String file)
          Delete the given file.
 boolean isPlainFile(java.lang.String file)
          Check if the name refers to a normal file as opposed to for example a directory.
 void list(java.lang.String path, java.io.OutputStream data)
          Lists the names of the files and directories in the given directory.
 boolean login(java.lang.String user, java.lang.String pass)
          Login to server.
 void mkdir(java.lang.String dir)
          Create a new directory.
 long modTime(java.lang.String file)
          Find out when a file was last modified.
 void nameList(java.lang.String path, java.io.OutputStream data)
          Lists the contents of the given directory.
 java.lang.String pwd()
          Get the current working directory.
 void quit()
          Close the ftp session.
 void renameFrom(java.lang.String from)
          The first step in a rename operation.
 void renameTo(java.lang.String to)
          The second step in the rename operation.
 void retrieve(java.lang.String file, java.io.OutputStream data, boolean binary)
          Retrieve a file from the server.
 void rmdir(java.lang.String dir)
          Remove the given directory.
 long size(java.lang.String file)
          Get the size of a file.
 void store(java.lang.String file, java.io.InputStream data, boolean binary)
          Store a file on the server.
 java.lang.String system()
          Get the type of system the server is running.
 

Method Detail

login

boolean login(java.lang.String user,
              java.lang.String pass)
Login to server.

Parameters:
user - Username to login as.
pass - Password.
Returns:
Returns true if the login was successful.

quit

void quit()
Close the ftp session.


isPlainFile

boolean isPlainFile(java.lang.String file)
Check if the name refers to a normal file as opposed to for example a directory.

Parameters:
file - The name of the file.
Returns:
True if the name refers to a plain file.

changeDirectory

void changeDirectory(java.lang.String dir)
                     throws FTPException
Change current directory on the server.

Parameters:
dir - Name of new directory
Throws:
FTPException

renameFrom

void renameFrom(java.lang.String from)
                throws FTPException
The first step in a rename operation. Specifies which file to rename. Must be folloed by a call to renameTo.

Parameters:
from - The name of the file to rename.
Throws:
FTPException

renameTo

void renameTo(java.lang.String to)
              throws FTPException
The second step in the rename operation. Specifies the new name of the file. Must be preceeded by a call to renameFrom

Parameters:
to - The new name of the file.
Throws:
FTPException

delete

void delete(java.lang.String file)
            throws FTPException
Delete the given file.

Parameters:
file - Name of the file to delete.
Throws:
FTPException

rmdir

void rmdir(java.lang.String dir)
           throws FTPException
Remove the given directory.

Parameters:
dir - Directory to remove.
Throws:
FTPException

mkdir

void mkdir(java.lang.String dir)
           throws FTPException
Create a new directory.

Parameters:
dir - Name of directory to create.
Throws:
FTPException

chmod

void chmod(int mod,
           java.lang.String file)
           throws FTPException
Modify the file permissions.

Parameters:
mod - New file permissions.
file - Name of file to modify.
Throws:
FTPException

pwd

java.lang.String pwd()
Get the current working directory.

Returns:
The path to the current working directory.

system

java.lang.String system()
Get the type of system the server is running.

Returns:
A string describing the system.

modTime

long modTime(java.lang.String file)
             throws FTPException
Find out when a file was last modified.

Parameters:
file - Name of file to investigate.
Returns:
The timestamp of the file.
Throws:
FTPException

size

long size(java.lang.String file)
          throws FTPException
Get the size of a file.

Parameters:
file - Name of file to get the size of.
Returns:
The size of the file.
Throws:
FTPException

store

void store(java.lang.String file,
           java.io.InputStream data,
           boolean binary)
           throws FTPException
Store a file on the server. Line endings are translated into the proper form for non-binary files.

Parameters:
file - Name to store file as.
data - Stream from which the contents of the file is read.
binary - Controls the translating of line endings.
Throws:
FTPException

retrieve

void retrieve(java.lang.String file,
              java.io.OutputStream data,
              boolean binary)
              throws FTPException
Retrieve a file from the server. Line endings are translated into the proper form for non-binary files.

Parameters:
file - Name of file to retrieve.
data - Stream to which the file content is written.
binary - Controls the translating of line endings.
Throws:
FTPException

list

void list(java.lang.String path,
          java.io.OutputStream data)
          throws FTPException
Lists the names of the files and directories in the given directory. The difference between this function and nameList is that the latter appends a trailing '/' to directory names.

Parameters:
path - Directory to list the contens of.
data - Stream to write the results to.
Throws:
FTPException

nameList

void nameList(java.lang.String path,
              java.io.OutputStream data)
              throws FTPException
Lists the contents of the given directory. The difference between this function and list is that the this appends a trailing '/' to directory names.

Parameters:
path - Directory to list the contens of.
data - Stream to write the results to.
Throws:
FTPException

abort

void abort()