net.sf.jftp.net
Interface BasicConnection

All Known Implementing Classes:
FilesystemConnection, FtpConnection, NfsConnection, Sftp2Connection, SmbConnection, WebdavConnection

public interface BasicConnection

Interface for all connection types


Method Summary
 void addConnectionListener(ConnectionListener listener)
          Add a ConnectionListener to be notified about progress and events.
 boolean cdup()
          Go up one directory if possible.
 boolean chdir(java.lang.String p)
          Change dircetory and inform listeners.
 boolean chdirNoRefresh(java.lang.String p)
          Change directory, but do not trigger an event for the listeners.
 void disconnect()
          Teminates the connection if necessary.
 int download(java.lang.String file)
          Initiate a download in the same thread.
 java.io.InputStream getDownloadInputStream(java.lang.String file)
          Initiate a download and return the content in form of an InputStream.
 java.lang.String getLocalPath()
          Get the path downloaded to.
 int[] getPermissions()
          Get file/dir permissions.
 java.lang.String getPWD()
          Get the current working dir.
 int handleDownload(java.lang.String file)
          Initiate a download, possibly non-blocking and in a new thread.
 int handleUpload(java.lang.String file)
          Initiate an upload, possibly non-blocking and in a new thread.
 boolean isConnected()
          Shows if the Connection is alive and initialized.
 void list()
          Perform any necessary actions so sortLs, sortSize and sortDates are up-to-date.
 boolean mkdir(java.lang.String dirName)
          Create a new directory.
 int removeFileOrDir(java.lang.String file)
          Remove the given item, recursively if necessary.
 boolean rename(java.lang.String from, java.lang.String to)
          Rename a file or directory.
 void sendRawCommand(java.lang.String cmd)
          Some Connections like FTP may allow raw command to be sent, use this method.
 void setConnectionListeners(java.util.Vector<ConnectionListener> listeners)
          Remove a ConnectionListener.
 boolean setLocalPath(java.lang.String newPath)
          Set the path downloded to.
 java.util.Date[] sortDates()
          Get file dates.
 java.lang.String[] sortLs()
          Get file and diretory names.
 java.lang.String[] sortSize()
          Get file sizes.
 int upload(java.lang.String file)
          Initiate an upload in the same thread.
 int upload(java.lang.String file, java.io.InputStream in)
          Initiate a download in the same thread.
 

Method Detail

sendRawCommand

void sendRawCommand(java.lang.String cmd)
Some Connections like FTP may allow raw command to be sent, use this method. Implementation is optional.

Parameters:
cmd -

disconnect

void disconnect()
Teminates the connection if necessary.


isConnected

boolean isConnected()
Shows if the Connection is alive and initialized.

Returns:

getPWD

java.lang.String getPWD()
Get the current working dir.

Returns:

cdup

boolean cdup()
Go up one directory if possible.

Returns:

mkdir

boolean mkdir(java.lang.String dirName)
Create a new directory.

Parameters:
dirName -
Returns:

rename

boolean rename(java.lang.String from,
               java.lang.String to)
Rename a file or directory.

Parameters:
from -
to -
Returns:

list

void list()
          throws java.io.IOException
Perform any necessary actions so sortLs, sortSize and sortDates are up-to-date. Implementation is optional.

Throws:
java.io.IOException

chdir

boolean chdir(java.lang.String p)
Change dircetory and inform listeners.

Parameters:
p -
Returns:

chdirNoRefresh

boolean chdirNoRefresh(java.lang.String p)
Change directory, but do not trigger an event for the listeners.

Parameters:
p -
Returns:

getLocalPath

java.lang.String getLocalPath()
Get the path downloaded to.

Returns:

setLocalPath

boolean setLocalPath(java.lang.String newPath)
Set the path downloded to.

Parameters:
newPath -
Returns:

sortLs

java.lang.String[] sortLs()
Get file and diretory names.

Returns:

sortSize

java.lang.String[] sortSize()
Get file sizes.

Returns:

sortDates

java.util.Date[] sortDates()
Get file dates.

Returns:

getPermissions

int[] getPermissions()
Get file/dir permissions.

Returns:

handleDownload

int handleDownload(java.lang.String file)
Initiate a download, possibly non-blocking and in a new thread.

Parameters:
file -
Returns:

handleUpload

int handleUpload(java.lang.String file)
Initiate an upload, possibly non-blocking and in a new thread.

Parameters:
file -
Returns:

download

int download(java.lang.String file)
Initiate a download in the same thread.

Parameters:
file -
Returns:

upload

int upload(java.lang.String file)
Initiate an upload in the same thread.

Parameters:
file -
Returns:

upload

int upload(java.lang.String file,
           java.io.InputStream in)
Initiate a download in the same thread. The InptuStream provides the date, file the remote file name.

Parameters:
file -
Returns:

getDownloadInputStream

java.io.InputStream getDownloadInputStream(java.lang.String file)
Initiate a download and return the content in form of an InputStream.

Parameters:
file -
Returns:

removeFileOrDir

int removeFileOrDir(java.lang.String file)
Remove the given item, recursively if necessary.

Parameters:
file -
Returns:

addConnectionListener

void addConnectionListener(ConnectionListener listener)
Add a ConnectionListener to be notified about progress and events.

Parameters:
listener -

setConnectionListeners

void setConnectionListeners(java.util.Vector<ConnectionListener> listeners)
Remove a ConnectionListener.

Parameters:
listeners -