com.enterprisedt.net.ftp.pro
Class ProFTPClient

java.lang.Object
  extended by com.enterprisedt.net.ftp.FTPClient
      extended by com.enterprisedt.net.ftp.pro.ProFTPClient
All Implemented Interfaces:
FTPClientInterface, ProFTPClientInterface
Direct Known Subclasses:
SSLFTPClient

public class ProFTPClient
extends FTPClient
implements ProFTPClientInterface

Subclass of FTPClient that adds numerous useful methods, mainly for getting and putting of multiple files, including recursively going through directories. Also supports IPV6.

Version:
$Revision: 1.10 $
Author:
Bruce Blackshaw

Field Summary
static java.lang.String cvsId
          Revision control id
 
Fields inherited from class com.enterprisedt.net.ftp.FTPClient
CARRIAGE_RETURN, control, controlEncoding, controlPort, data, DEFAULT_BUFFER_SIZE, DEFAULT_ENCODING, DEFAULT_LISTING_LOCALES, DEFAULT_MONITOR_INTERVAL, DEFAULT_TIMEOUT, detectTransferMode, dirEmptyStrings, fileNotFoundStrings, FTP_LINE_SEPARATOR, id, lastReply, lastValidReply, LINE_FEED, messageListener, monitor, monitorEx, monitorInterval, remoteAddr, remoteHost, serverWakeupInterval, timeout, transferBufferSize, transferCompleteStrings, transferType
 
Constructor Summary
ProFTPClient()
          Default constructor.
 
Method Summary
 void connect()
          Connects to the server at the address and port number defined in the constructor.
 int getCountBeforeSleep()
          Get the number of transfers set before sleeping
 int getSleepTime()
          Get the number of seconds spent asleep
 boolean isSleepEnabled()
          Is sleeping enabled?
 void mdelete(java.io.FileFilter filter)
          Deletes all files matching the filter in the current remote directory only
 void mdelete(java.lang.String wildcard)
          Deletes all files matching the wildcard in the current remote directory only
 void mdelete(java.lang.String remoteDir, java.io.FileFilter filter, boolean recurse)
          Delete all the files in this directory (and its subdirectories if recurse is true) that match the supplied filter.
 void mdelete(java.lang.String remoteDir, java.lang.String wildcard, boolean recurse)
          Delete all the files in this directory (and its subdirectories if recurse is true) that match the supplied wildcard.
 void mget(java.lang.String localDir, java.io.FileFilter filter)
          Get all files matching the filter in the current remote directory only into the supplied local directory
 void mget(java.lang.String localDir, java.lang.String wildcard)
          Get all files matching the filter in the current remote directory only into the supplied local directory
 void mget(java.lang.String localDir, java.lang.String remoteDir, java.io.FileFilter filter, boolean recurse)
          Gets this entire remote directory and its contents, recursively going through the remote directory name supplied.
 void mget(java.lang.String localDir, java.lang.String remoteDir, java.lang.String wildcard, boolean recurse)
          Gets this entire remote directory and its contents, recursively going through the remote directory name supplied.
 void mput(java.lang.String localDir, java.io.FileFilter filter)
          Put all files matching the wildcard in the supplied local directory only into the current remote directory
 void mput(java.lang.String localDir, java.lang.String wildcard)
          Put all files matching the wildcard in the supplied local directory only into the current remote directory
 void mput(java.lang.String localDir, java.lang.String remoteDir, java.io.FileFilter filter, boolean recurse)
          Puts this entire directory and its contents.
 void mput(java.lang.String localDir, java.lang.String remoteDir, java.lang.String wildcard, boolean recurse)
          Puts this entire directory and its contents.
 void rmdir(java.lang.String remoteDir, boolean recurse)
          Delete this remote directory.
 void setCountBeforeSleep(int countBeforeSleep)
          Set the number of transfers required before sleeping
 void setSleepEnabled(boolean sleepEnabled)
          Set sleeping enabled to be on or off
 void setSleepTime(int sleepTime)
          Set the time spent asleep
 
Methods inherited from class com.enterprisedt.net.ftp.FTPClient
abort, account, cancelResume, cancelTransfer, cdup, chdir, checkConnection, chooseTransferMode, clearSOCKS, closeDataSocket, closeDataSocket, connected, debugResponses, delete, dir, dir, dir, dirDetails, executeCommand, exists, features, fileDetails, forceResumeOff, get, get, get, getActiveHighPort, getActiveIPAddress, getActiveLowPort, getBuildTimestamp, getConnectMode, getControlEncoding, getControlPort, getDeleteCount, getDetectTransferMode, getDirectoryEmptyMessages, getDownloadCount, getFileNotFoundMessages, getId, getLastReply, getLastValidReply, getListenOnAllInterfaces, getMessageListener, getMonitorInterval, getProgressMonitor, getProgressMonitorEx, getRemoteAddr, getRemoteHost, getRemotePort, getServerWakeupInterval, getTimeout, getTransferBufferSize, getTransferCompleteMessages, getType, getUploadCount, getVersion, help, initGet, initialize, initPut, initSOCKS, initSOCKSAuthentication, isAutoPassiveIPSubstitution, isDeleteOnFailure, isStrictReturnCodes, isTransferCancelled, keepAlive, list, list, login, login, mkdir, modtime, noOperation, password, put, put, put, put, put, put, pwd, quit, quitImmediately, quote, quote, readChar, readChunk, readLine, rename, resetDeleteCount, resetDownloadCount, resetTransferMode, resetUploadCount, restart, resume, rmdir, sendCommand, sendServerWakeup, setActiveIPAddress, setActivePortRange, setAutoPassiveIPSubstitution, setConnectMode, setControlEncoding, setControlPort, setDeleteOnFailure, setDetectTransferMode, setDirectoryEmptyMessages, setFileNotFoundMessages, setForceUniqueNames, setFTPFileFactory, setId, setListenOnAllInterfaces, setMessageListener, setModTime, setMonitorInterval, setParserLocale, setParserLocales, setPORTIP, setProgressMonitor, setProgressMonitor, setProgressMonitorEx, setRemoteAddr, setRemoteHost, setRemotePort, setServerWakeupInterval, setStrictReturnCodes, setTimeout, setTransferBufferSize, setTransferCompleteMessages, setType, setupDataSocket, site, size, stat, system, toString, user, validateReply, validateReply, validateTransfer, validateTransferOnError
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.enterprisedt.net.ftp.FTPClientInterface
cancelResume, cancelTransfer, cdup, chdir, connected, delete, dir, dir, dir, dirDetails, executeCommand, exists, get, get, get, getDeleteCount, getDetectTransferMode, getDownloadCount, getId, getMonitorInterval, getRemoteHost, getRemotePort, getTimeout, getType, getUploadCount, keepAlive, mkdir, modtime, put, put, put, put, put, put, pwd, quit, quitImmediately, rename, resetDeleteCount, resetDownloadCount, resetUploadCount, resume, rmdir, setControlEncoding, setDetectTransferMode, setId, setModTime, setProgressMonitor, setProgressMonitor, setRemoteHost, setRemotePort, setTimeout, setType, size, system
 

Field Detail

cvsId

public static final java.lang.String cvsId
Revision control id

See Also:
Constant Field Values
Constructor Detail

ProFTPClient

public ProFTPClient()
Default constructor. The FTPClient.connect() method is used to perform the actual connection to the remote host.

Method Detail

connect

public void connect()
             throws java.io.IOException,
                    FTPException
Connects to the server at the address and port number defined in the constructor. Must be performed before login() or user() is called.

Specified by:
connect in interface FTPClientInterface
Overrides:
connect in class FTPClient
Throws:
java.io.IOException - Thrown if there is a TCP/IP-related error.
FTPException - Thrown if there is an error related to the FTP protocol.

mdelete

public void mdelete(java.lang.String wildcard)
             throws java.io.IOException,
                    FTPException,
                    java.text.ParseException
Description copied from interface: ProFTPClientInterface
Deletes all files matching the wildcard in the current remote directory only

Specified by:
mdelete in interface ProFTPClientInterface
Throws:
java.io.IOException
FTPException
java.text.ParseException

mdelete

public void mdelete(java.io.FileFilter filter)
             throws java.io.IOException,
                    FTPException,
                    java.text.ParseException
Description copied from interface: ProFTPClientInterface
Deletes all files matching the filter in the current remote directory only

Specified by:
mdelete in interface ProFTPClientInterface
Parameters:
filter - file filter
Throws:
java.io.IOException
FTPException
java.text.ParseException

mdelete

public void mdelete(java.lang.String remoteDir,
                    java.lang.String wildcard,
                    boolean recurse)
             throws java.io.IOException,
                    FTPException,
                    java.text.ParseException
Description copied from interface: ProFTPClientInterface
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.

Specified by:
mdelete in interface ProFTPClientInterface
Parameters:
remoteDir - name of remote directory
wildcard - filename wildcard
recurse - if true, recurse through subdirectories
Throws:
java.io.IOException
FTPException
java.text.ParseException

mdelete

public void mdelete(java.lang.String remoteDir,
                    java.io.FileFilter filter,
                    boolean recurse)
             throws java.io.IOException,
                    FTPException,
                    java.text.ParseException
Description copied from interface: ProFTPClientInterface
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.

Specified by:
mdelete in interface ProFTPClientInterface
Parameters:
remoteDir - name of remote directory
filter - filename filter
recurse - if true, recurse through subdirectories
Throws:
java.io.IOException
FTPException
java.text.ParseException

rmdir

public void rmdir(java.lang.String remoteDir,
                  boolean recurse)
           throws java.io.IOException,
                  FTPException,
                  java.text.ParseException
Description copied from interface: ProFTPClientInterface
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

Specified by:
rmdir in interface ProFTPClientInterface
Parameters:
remoteDir - name of remote directory
recurse - if true, recurse through subdirectories
Throws:
java.io.IOException
FTPException
java.text.ParseException

mput

public void mput(java.lang.String localDir,
                 java.lang.String wildcard)
          throws java.io.IOException,
                 FTPException
Description copied from interface: ProFTPClientInterface
Put all files matching the wildcard in the supplied local directory only into the current remote directory

Specified by:
mput in interface ProFTPClientInterface
Parameters:
localDir - local directory to get files from
wildcard - filename wildcard
Throws:
java.io.IOException
FTPException

mput

public void mput(java.lang.String localDir,
                 java.io.FileFilter filter)
          throws java.io.IOException,
                 FTPException
Description copied from interface: ProFTPClientInterface
Put all files matching the wildcard in the supplied local directory only into the current remote directory

Specified by:
mput in interface ProFTPClientInterface
Parameters:
localDir - local directory to get files from
filter - filename filter
Throws:
java.io.IOException
FTPException

mput

public void mput(java.lang.String localDir,
                 java.lang.String remoteDir,
                 java.lang.String wildcard,
                 boolean recurse)
          throws FTPException,
                 java.io.IOException
Description copied from interface: ProFTPClientInterface
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.

Specified by:
mput in interface ProFTPClientInterface
Parameters:
localDir - name of local directory
remoteDir - name of remote directory
wildcard - filename wildcard
recurse - if true recurse into subdirectories
Throws:
FTPException
java.io.IOException

mput

public void mput(java.lang.String localDir,
                 java.lang.String remoteDir,
                 java.io.FileFilter filter,
                 boolean recurse)
          throws FTPException,
                 java.io.IOException
Description copied from interface: ProFTPClientInterface
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.

Specified by:
mput in interface ProFTPClientInterface
Parameters:
localDir - name of local directory
remoteDir - name of remote directory
filter - filename filter
recurse - if true recurse into subdirectories
Throws:
FTPException
java.io.IOException

mget

public void mget(java.lang.String localDir,
                 java.lang.String wildcard)
          throws java.io.IOException,
                 FTPException,
                 java.text.ParseException
Description copied from interface: ProFTPClientInterface
Get all files matching the filter in the current remote directory only into the supplied local directory

Specified by:
mget in interface ProFTPClientInterface
Parameters:
localDir - local directory to get files from
wildcard - filename wildcard
Throws:
java.io.IOException
FTPException
java.text.ParseException

mget

public void mget(java.lang.String localDir,
                 java.io.FileFilter filter)
          throws java.io.IOException,
                 FTPException,
                 java.text.ParseException
Description copied from interface: ProFTPClientInterface
Get all files matching the filter in the current remote directory only into the supplied local directory

Specified by:
mget in interface ProFTPClientInterface
Parameters:
localDir - local directory to get files from
filter - filename filter
Throws:
java.io.IOException
FTPException
java.text.ParseException

mget

public void mget(java.lang.String localDir,
                 java.lang.String remoteDir,
                 java.lang.String wildcard,
                 boolean recurse)
          throws FTPException,
                 java.io.IOException,
                 java.text.ParseException
Description copied from interface: ProFTPClientInterface
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

Specified by:
mget in interface ProFTPClientInterface
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:
FTPException
java.io.IOException
java.text.ParseException

mget

public void mget(java.lang.String localDir,
                 java.lang.String remoteDir,
                 java.io.FileFilter filter,
                 boolean recurse)
          throws FTPException,
                 java.io.IOException,
                 java.text.ParseException
Description copied from interface: ProFTPClientInterface
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

Specified by:
mget in interface ProFTPClientInterface
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:
FTPException
java.io.IOException
java.text.ParseException

getCountBeforeSleep

public int getCountBeforeSleep()
Description copied from interface: ProFTPClientInterface
Get the number of transfers set before sleeping

Specified by:
getCountBeforeSleep in interface ProFTPClientInterface
Returns:
integer

setCountBeforeSleep

public void setCountBeforeSleep(int countBeforeSleep)
Description copied from interface: ProFTPClientInterface
Set the number of transfers required before sleeping

Specified by:
setCountBeforeSleep in interface ProFTPClientInterface
Parameters:
countBeforeSleep - maximum transfer count

isSleepEnabled

public boolean isSleepEnabled()
Description copied from interface: ProFTPClientInterface
Is sleeping enabled?

Specified by:
isSleepEnabled in interface ProFTPClientInterface
Returns:
true if enabled

setSleepEnabled

public void setSleepEnabled(boolean sleepEnabled)
Description copied from interface: ProFTPClientInterface
Set sleeping enabled to be on or off

Specified by:
setSleepEnabled in interface ProFTPClientInterface
Parameters:
sleepEnabled - if true, sleeping is enabled, otherwise it is switched off

getSleepTime

public int getSleepTime()
Description copied from interface: ProFTPClientInterface
Get the number of seconds spent asleep

Specified by:
getSleepTime in interface ProFTPClientInterface
Returns:
integer

setSleepTime

public void setSleepTime(int sleepTime)
Description copied from interface: ProFTPClientInterface
Set the time spent asleep

Specified by:
setSleepTime in interface ProFTPClientInterface
Parameters:
sleepTime - sleep time in seconds


Copyright © 2001-2006 Enterprise Distributed Technologies Ltd. All Rights Reserved.