Interface ProFTPClientInterface

All Superinterfaces:
FTPClientInterface
All Known Implementing Classes:
ProFTPClient, SSHFTPClient, SSLFTPClient

public interface ProFTPClientInterface extends FTPClientInterface
Interface defining additional operations for FTP clients. These include the API equivalents of command line FTP clients' mput and mget.

Some operations permit a wildcard string to be supplied for matching filenames (directories are not matched against the wildcard). The syntax used is '?' for single chars and '*' for multiple chars, e.g. 'asdf??df*abc' would match 'asdfxydfdsfsjfkj33abc'. On Windows clients, case is ignored.

Note that if there are a large number of files to be transferred, the client or server may run out of sockets, as a new socket is created for each data transfer and each directory listing. TCP's TIME_WAIT means that sockets are not reclaimed immediately. If sleeping is enabled via setSleepEnabled(true), then Thread.sleep() is called after n transfers, where n is set by setCountBeforeSleep(n). The time spent asleep is set via setSleepTime().

Version:
$Revision$
Author:
Bruce Blackshaw
  • Field Details

  • Method Details

    • getProgressMonitorEx

      FTPProgressMonitorEx getProgressMonitorEx()
      Get reference to the extended progress monitor
      Returns:
      FTPProgressMonitorEx
    • setProgressMonitorEx

      void setProgressMonitorEx(FTPProgressMonitorEx monitorEx)
      Set a extended progress monitor for callbacks.
      Parameters:
      monitor - the monitor object
    • setMonitorInterval

      void setMonitorInterval(long interval)
      Set the bytes transferred between each callback on the progress monitors
    • getProxySettings

      ProxySettings getProxySettings()
      Get the proxy settings instance. Its properties can be set to use proxies.
      Returns:
      ProxySettings
    • setMaxTransferRate

      void setMaxTransferRate(int thresholdBytesPerSecond)
      Set the maximum transfer rates in bytes per sec
      Parameters:
      thresholdBytesPerSecond - maximum bytes per second to transfer
    • getMaxTransferRate

      int getMaxTransferRate()
      Get the maximum bandwidth for transfers
      Returns:
      threshold bytes per second, or -1 if no threshold
    • mdelete

      void mdelete(String wildcard) throws IOException, FTPException, ParseException
      Deletes all files matching the wildcard in the current remote directory only
      Parameters:
      wildcard -
      Throws:
      IOException
      FTPException
      ParseException
    • mdelete

      void mdelete(FileFilter filter) throws IOException, FTPException, ParseException
      Deletes all files matching the filter in the current remote directory only
      Parameters:
      filter - file filter
      Throws:
      IOException
      FTPException
      ParseException
    • mdelete

      void mdelete(String remoteDir, String wildcard, boolean recurse) throws IOException, FTPException, ParseException
      Delete all the files in this directory (and its subdirectories if recurse is true) that match the supplied wildcard. No directories are deleted. Only files matching the wildcard are deleted. On Windows clients, case is ignored.
      Parameters:
      remoteDir - name of remote directory
      wildcard - filename wildcard
      recurse - if true, recurse through subdirectories
      Throws:
      IOException
      FTPException
      ParseException
    • mdelete

      void mdelete(String remoteDir, FileFilter filter, boolean recurse) throws IOException, FTPException, ParseException
      Delete all the files in this directory (and its subdirectories if recurse is true) that match the supplied filter. No directories are deleted. Only files matching the wildcard are deleted. On Windows clients, case is ignored.
      Parameters:
      remoteDir - name of remote directory
      filter - filename filter
      recurse - if true, recurse through subdirectories
      Throws:
      IOException
      FTPException
      ParseException
    • rmdir

      void rmdir(String remoteDir, boolean recurse) throws IOException, FTPException, ParseException
      Delete this remote directory. If recurse is true, delete all its contents, recursively going through subdirectories. If recurse is false and the directory contains files, an exception will be thrown
      Parameters:
      remoteDir - name of remote directory
      recurse - if true, recurse through subdirectories
      Throws:
      IOException
      FTPException
      ParseException
    • mput

      void mput(String localDir, String wildcard) throws IOException, FTPException
      Put all files matching the wildcard in the supplied local directory only into the current remote directory
      Parameters:
      localDir - local directory to get files from
      wildcard - filename wildcard
      Throws:
      IOException
      FTPException
    • mput

      void mput(String localDir, FileFilter filter) throws IOException, FTPException
      Put all files matching the wildcard in the supplied local directory only into the current remote directory
      Parameters:
      localDir - local directory to get files from
      filter - filename filter
      Throws:
      IOException
      FTPException
    • mput

      void mput(String localDir, String remoteDir, String wildcard, boolean recurse) throws FTPException, IOException
      Puts this entire directory and its contents. If recurse is true, recursively go through the local directory supplied (which can be relative or absolute), including subdirectories. Puts the directory into the current remote directory, into a directory with the supplied remoteDir name.
      Parameters:
      localDir - name of local directory
      remoteDir - name of remote directory
      wildcard - filename wildcard
      recurse - if true recurse into subdirectories
      Throws:
      IOException
      FTPException
    • mput

      void mput(String localDir, String remoteDir, FileFilter filter, boolean recurse) throws FTPException, IOException
      Puts this entire directory and its contents. If recurse is true, recursively go through the local directory supplied (which can be relative or absolute), including subdirectories. Puts the directory into the current remote directory, into a directory with the supplied remoteDir name.
      Parameters:
      localDir - name of local directory
      remoteDir - name of remote directory
      filter - filename filter
      recurse - if true recurse into subdirectories
      Throws:
      IOException
      FTPException
    • mget

      void mget(String localDir, String wildcard) throws FTPException, IOException, ParseException
      Get all files matching the filter in the current remote directory only into the supplied local directory
      Parameters:
      localDir - local directory to get files from
      wildcard - filename wildcard
      Throws:
      IOException
      FTPException
      ParseException
    • mget

      void mget(String localDir, FileFilter filter) throws FTPException, IOException, ParseException
      Get all files matching the filter in the current remote directory only into the supplied local directory
      Parameters:
      localDir - local directory to get files from
      filter - filename filter
      Throws:
      IOException
      FTPException
      ParseException
    • mget

      void mget(String localDir, String remoteDir, String wildcard, boolean recurse) throws FTPException, IOException, ParseException
      Gets this entire remote directory and its contents, recursively going through the remote directory name supplied. Gets the directory into the current local directory, into a directory with supplied localDir name
      Parameters:
      localDir - name of local directory we are transferring into
      remoteDir - name of remote directory
      wildcard - filename wildcard
      recurse - if true recurse into subdirectories
      Throws:
      IOException
      FTPException
      ParseException
    • mget

      void mget(String localDir, String remoteDir, FileFilter filter, boolean recurse) throws FTPException, IOException, ParseException
      Gets this entire remote directory and its contents, recursively going through the remote directory name supplied. Gets the directory into the current local directory, into a directory with supplied localDir name
      Parameters:
      localDir - name of local directory we are transferring into
      remoteDir - name of remote directory
      filter - filename filter
      recurse - if true recurse into subdirectories
      Throws:
      IOException
      FTPException
      ParseException
    • getCountBeforeSleep

      int getCountBeforeSleep()
      Get the number of transfers set before sleeping
      Returns:
      integer
    • setCountBeforeSleep

      void setCountBeforeSleep(int countBeforeSleep)
      Set the number of transfers required before sleeping
      Parameters:
      countBeforeSleep - maximum transfer count
    • isSleepEnabled

      boolean isSleepEnabled()
      Is sleeping enabled?
      Returns:
      true if enabled
    • setSleepEnabled

      void setSleepEnabled(boolean sleepEnabled)
      Set sleeping enabled to be on or off
      Parameters:
      sleepEnabled - if true, sleeping is enabled, otherwise it is switched off
    • getSleepTime

      int getSleepTime()
      Get the number of seconds spent asleep
      Returns:
      integer
    • setSleepTime

      void setSleepTime(int sleepTime)
      Set the time spent asleep
      Parameters:
      sleepTime - sleep time in seconds