org.backsource.adaptor.ftp
Interface FTPConnection

All Known Implementing Classes:
NetFTPConnection

public interface FTPConnection

Interface for an FTPConnection received from a FTPConnectionFactory.

A FTPConnection will be in a logged in state when returned from the factory. There is however no guarantee that it will stay in that mode due to FTP server timeout or socket timeout. A connection that is no longer in alive mode should be closed and a new connection must be retrived from the factory.

See FTPConnectionFactory for some examples.

Version:
$Revision: 1.1.1.1 $
Author:
Peter Antman

Method Summary
 void cd(java.lang.String dir)
          Change dir.
 void close()
          Close the connection, effectively leaving it back to the factory.
 void deleteFile(java.lang.String pathname)
          Delete specifyed file, pathname may contains directory path.
 java.io.InputStream get(java.lang.String url)
          Get the specifyed file from the server.
 java.lang.String getWorkingDirectory()
          Get the name of the working directory.
 boolean isAlive()
          Check if connection is alive.
 java.util.List list(java.lang.String url)
          List files in dir url or if single file list that file, to list files in the current directory use a .
 void mkdir(java.lang.String pathname)
          Create a directory specifyed by pathname.
 void put(java.lang.String url, java.io.InputStream localStream)
          Put stream on server in file named by url, the url may denote a file with a directory path.
 void setBinaryMode(boolean binaryMode)
          Set mode of connection, false means ascii mode.
 void setPassiveMode(boolean passiveMode)
          Set passive mode.
 

Method Detail

close

public void close()
Close the connection, effectively leaving it back to the factory.


setBinaryMode

public void setBinaryMode(boolean binaryMode)
                   throws FTPException
Set mode of connection, false means ascii mode.

Throws:
FTPException

setPassiveMode

public void setPassiveMode(boolean passiveMode)
                    throws FTPException
Set passive mode.

Throws:
FTPException

isAlive

public boolean isAlive()
Check if connection is alive.

This will also work as a ping, and may thefore be called from a ping thtread to keep the connection alive.


list

public java.util.List list(java.lang.String url)
                    throws FTPException
List files in dir url or if single file list that file, to list files in the current directory use a . as url.

Returns:
a list of FTPFiles.
Throws:
FTPException

get

public java.io.InputStream get(java.lang.String url)
                        throws FTPException
Get the specifyed file from the server.

The input will be cached locally, and it is the callers responisbility to close the stream when used.

Throws:
FTPException

put

public void put(java.lang.String url,
                java.io.InputStream localStream)
         throws FTPException
Put stream on server in file named by url, the url may denote a file with a directory path.

It is the resonibility of the caller to close the stream when the method return.

Throws:
FTPException

deleteFile

public void deleteFile(java.lang.String pathname)
                throws FTPException
Delete specifyed file, pathname may contains directory path.

Throws:
FTPException

mkdir

public void mkdir(java.lang.String pathname)
           throws FTPException
Create a directory specifyed by pathname.

Throws:
FTPException

getWorkingDirectory

public java.lang.String getWorkingDirectory()
                                     throws FTPException
Get the name of the working directory.

Throws:
FTPException

cd

public void cd(java.lang.String dir)
        throws FTPException
Change dir.

Throws:
FTPException


Copyright © 2003-2004 Backsource. All Rights Reserved.