Secure FTP Factory

com.jscape.filetransfer
Class FtpsTransfer

java.lang.Object
  extended by com.jscape.filetransfer.FtpsTransfer
All Implemented Interfaces:
FileTransfer
Direct Known Subclasses:
FtpsImplicitTransfer

public class FtpsTransfer
extends java.lang.Object
implements FileTransfer

Implements the basic functionality of a FTPS client using explicit SSL.

Example Usage:

  // create new FtpsTransfer instance
  FileTransfer ftp = new FtpsTransfer("ftp.myserver.com","anonymous","user@myserver.com");
  try {
  // connect to FTP server
  ftp.connect();
  <p/>
  // print out directory listing
  System.out.println(ftp.getDirListingAsString());
  <p/>
  // disconnect from FTP server
  ftp.disconnect();
  } catch(Exception e) {
  System.out.println(e);
  }
 


Field Summary
 
Fields inherited from interface com.jscape.filetransfer.FileTransfer
ASCII, AUTO, BINARY, CURRENT_DIR, UP_DIR
 
Constructor Summary
FtpsTransfer()
          Creates FtpsTransfer instance.
FtpsTransfer(java.lang.String host, java.lang.String user, java.lang.String pwd)
          Creates FtpsTransfer instance.
FtpsTransfer(java.lang.String host, java.lang.String user, java.lang.String pwd, java.io.File localDirectory)
          Creates FtpsTransfer instance.
FtpsTransfer(java.lang.String host, java.lang.String user, java.lang.String pwd, int port)
          Creates FtpsTransfer instance.
FtpsTransfer(java.lang.String host, java.lang.String user, java.lang.String pwd, java.lang.Integer port)
          Method FtpsTransfer
 
Method Summary
 void abortDownloadThreads()
          Abort download threads.
 void abortUploadThreads()
          Abort upload threads.
 void addFileTransferListener(FileTransferListener listener)
          See FileTransfer interface for method description.
 void addFtpsCertificateVerifier(FtpsCertificateVerifier listener)
          Set certificate verifier handle acceptance of SSL certificate.
 void changePassword(java.lang.String oldPassword, java.lang.String newPassword)
          Changes the password.
 void checksum(java.io.File localFile, java.lang.String remoteFile)
           
 void clearCommandChannel()
          Clears command channel.
 void clearProxySettings()
          Clears proxy server values.
 void connect()
          See FileTransfer interface for method description.
 void connect(boolean login)
          Establishes a connection with FTP server with optional login
 void deleteDir(java.lang.String name)
          See FileTransfer interface for method description.
 void deleteDir(java.lang.String name, boolean recursive)
          See FileTransfer interface for method description.
 void deleteFile(java.lang.String remoteFile)
          See FileTransfer interface for method description.
 void disconnect()
          See FileTransfer interface for method description.
 void download(java.io.OutputStream out, java.lang.String remoteFile)
          See FileTransfer interface for method description.
 java.io.File download(java.lang.String remoteFile)
          See FileTransfer interface for method description.
 java.io.File download(java.lang.String localFile, java.lang.String remoteFile)
          See FileTransfer interface for method description.
 void downloadDir(java.lang.String remoteDir)
          See FileTransfer interface for method description.
 void downloadDir(java.lang.String remoteDir, int retryLimit, boolean performChecksum)
          Downloads remote directory and contents.
 void downloadDir(java.lang.String remoteDir, int retryLimit, boolean performChecksum, int threadCount)
          Download directory.
 boolean getAutoDetectIpv6()
          Get auto detect Ipv6.
 int getBlockTransferSize()
          Gets blocksize for use in transferring files.
 boolean getDebug()
          See FileTransfer interface for method description.
 java.io.PrintStream getDebugStream()
          See FileTransfer interface for method description.
 java.lang.String getDir()
          See FileTransfer interface for method description.
 java.util.Enumeration getDirListing()
          See FileTransfer interface for method description.
 java.util.Enumeration getDirListing(java.lang.String filter)
          See FileTransfer interface for method description.
 java.lang.String getDirListingAsString()
          See FileTransfer interface for method description.
 java.lang.String getDirListingAsString(java.lang.String filter)
          See FileTransfer interface for method description.
 boolean getErrorOnSizeCommand()
          Gets the error on size command indicator.
 long getFilesize(java.lang.String remoteFile)
          See FileTransfer interface for method description.
 java.util.Date getFileTimestamp(java.lang.String remoteFile)
          See FileTransfer interface for method description.
 java.lang.String getHostname()
          See FileTransfer interface for method description.
 java.lang.Object getImplementation()
          See FileTransfer interface for method description.
 java.io.InputStream getInputStream(java.lang.String remoteFile, long pos)
          Gets InputStream for remote file for reading.
 java.lang.String getLocalChecksum(java.io.File localFile)
          Returns local checksum.
 java.io.File getLocalDir()
          See FileTransfer interface for method description.
 java.util.Enumeration getLocalDirListing()
          See FileTransfer interface for method description.
 int getMode()
          See FileTransfer interface for method description.
 java.util.Enumeration getNameListing()
          See FileTransfer interface for method description.
 java.util.Enumeration getNameListing(java.lang.String filter)
          See FileTransfer interface for method description.
 java.io.OutputStream getOutputStream(java.lang.String fileName, long off, boolean append)
          Gets OutputStream for writing to remote file.
 boolean getPassive()
          See FileTransfer interface for method description.
 java.lang.String getPassword()
          See FileTransfer interface for method description.
 int getPort()
          See FileTransfer interface for method description.
 int getRecursiveDirectoryFileCount(java.lang.String directory)
          Get recursive file count.
 long getRecursiveDirectorySize(java.lang.String directory)
          Get recursive directory size.
 java.lang.String getRemoteFileChecksum(java.lang.String remoteFile)
          Returns remote file checksum.
 java.util.Vector getRemoteFileList(java.lang.String directory)
          Get remote file list.
 boolean getShutdownCCC()
          Gets whether SSL connection should be shutdown after successfully issuing CCC command.
 long getTimeout()
          See FileTransfer interface for method description.
 boolean getUseEPRT()
          Gets use EPRT value.
 boolean getUseEPSV()
          Gets use EPSV value.
 java.lang.String getUsername()
          See FileTransfer interface for method description.
 java.lang.String getWireEncoding()
          Gets encoding set used when issuing commands and transferring files
 void interrupt()
          See FileTransfer interface for method description.
 boolean interrupted()
          See FileTransfer interface for method description.
 boolean isConnected()
          See FileTransfer interface for method description.
 boolean isFeatureSupported(java.lang.String command)
           
 void issueCommand(java.lang.String command)
          Issues command to the server.
 void login()
          Logs into FTP server after establishing a connection.
 void makeDir(java.lang.String name)
          See FileTransfer interface for method description.
 void makeDirRecursive(java.lang.String name)
          See FileTransfer interface for method description.
 java.io.File makeLocalDir(java.lang.String name)
          See FileTransfer interface for method description.
 void mdelete(java.lang.String filter)
          Deletes multiple files matching filter to FTP server's current directory.
 void mdownload(java.util.Enumeration fileNames)
          See FileTransfer interface for method description.
 void mdownload(java.lang.String filter)
          See FileTransfer interface for method description.
 void mupload(java.util.Enumeration fileNames)
          See FileTransfer interface for method description.
 void mupload(java.lang.String filter)
          See FileTransfer interface for method description.
 void removeFileTransferListener(FileTransferListener listener)
          See FileTransfer interface for method description.
 void renameFile(java.lang.String remoteFile, java.lang.String newFile)
          See FileTransfer interface for method description.
 void reset()
          See FileTransfer interface for method description.
 void resumeDownload(java.lang.String remoteFile, long offset)
          See FileTransfer interface for method description.
 void resumeDownload(java.lang.String localFile, java.lang.String remoteFile, long offset)
          See FileTransfer interface for method description.
 void resumeUpload(java.io.File file, long offset)
          See FileTransfer interface for method description.
 void resumeUpload(java.lang.String file, long offset)
          See FileTransfer interface for method description.
 void setAscii()
          See FileTransfer interface for method description.
 void setAuto(boolean auto)
          See FileTransfer interface for method description.
 void setAutoDetectIpv6(boolean autoDetect)
          Set auto detect Ipv6.
 void setBinary()
          See FileTransfer interface for method description.
 void setBlockTransferSize(int blocksize)
          Sets block size for use in transferring files.
 void setClientCertificates(java.security.KeyStore keystore, java.lang.String password)
          Sets optional client certificate keystore for use during authentication.
 void setClientCertificates(java.lang.String filename, java.lang.String password)
          Sets optional client certificate to be used during authentication.
 void setClientCertificates(java.lang.String filename, java.lang.String password, java.lang.String storetype)
          Sets optional client certificate to be used during authentication.
 void setCompression(boolean compression)
          Sets whether the data will be compressed during the transfering.
 void setConnectBeforeCommand(boolean before)
          Sets the connectBefore property value
 void setDebug(boolean debug)
          See FileTransfer interface for method description.
 void setDebugStream(java.io.PrintStream ps)
          See FileTransfer interface for method description.
 void setDir(java.lang.String name)
          See FileTransfer interface for method description.
 void setDirUp()
          See FileTransfer interface for method description.
 void setErrorOnSizeCommand(boolean error)
          Sets the indicator value which will be used by methods that invokes getFileSize.
 void setFileTimestamp(java.lang.String remoteFile, java.util.Date dateFile)
          See FileTransfer interface for method description.
 void setHostname(java.lang.String host)
          See FileTransfer interface for method description.
 void setLocalDir(java.io.File dir)
          See FileTransfer interface for method description.
 void setNATAddress(java.lang.String ipAddress)
          Sets a NAT address which will be used after PASV command.
 void setPassive(boolean passive)
          See FileTransfer interface for method description.
 void setPassword(java.lang.String password)
          See FileTransfer interface for method description.
 void setPort(int port)
          See FileTransfer interface for method description.
 void setProxyAuthentication(java.lang.String proxyUsername, java.lang.String proxyPassword)
          Sets the proxy authentication username and password to use with proxy server.
 void setProxyHost(java.lang.String proxyHostname, int proxyPort)
          Sets the proxy hostname and port for this connection.
 void setProxyType(java.lang.String proxyType)
          Sets the proxy type will be used for this connection.
 void setServerCertificates(java.security.KeyStore keystore)
          Sets optional server certificate keystore to use during authentication.
 void setServerCertificates(java.lang.String filename, java.lang.String password)
          Sets optional server certificate to be used during authentication.
 void setServerCertificates(java.lang.String filename, java.lang.String password, java.lang.String storetype)
          Sets optional server certificate to be used during authentication.
 void setShutdownCCC(boolean shutdownCCC)
          Sets whether SSL connection should be shutdown after successfully issuing CCC command.
 void setTimeout(long timeout)
          See FileTransfer interface for method description.
 void setUseEPRT(boolean useEPRT)
          Set use EPRT.
 void setUseEPSV(boolean useEPSV)
          Sets use EPSV indicator.
 void setUseExtendedDirectoryListing(boolean useExtendedDirectoryListing)
          Sets the use extended directory listing field.
 void setUsername(java.lang.String username)
          See FileTransfer interface for method description.
 void setWireEncoding(java.lang.String encoding)
          Sets encoding set used when issuing commands and transferring files.
 void upload(byte[] data, java.lang.String name)
          See FileTransfer interface for method description.
 void upload(byte[] data, java.lang.String name, boolean append)
          See FileTransfer interface for method description.
 void upload(java.io.File file)
          See FileTransfer interface for method description.
 void upload(java.io.File file, boolean append)
          See FileTransfer interface for method description.
 void upload(java.io.File file, java.lang.String remoteName)
          See FileTransfer interface for method description.
 void upload(java.io.File file, java.lang.String remoteName, boolean append)
          See FileTransfer interface for method description.
 void upload(java.lang.String name)
          See FileTransfer interface for method description.
 void upload(java.lang.String name, boolean append)
          See FileTransfer interface for method description.
 void upload(java.lang.String extension, java.io.File file)
          Uploads a file to server with the extension specified by the argument.
 void upload(java.lang.String name, java.lang.String remoteName)
          See FileTransfer interface for method description.
 void upload(java.lang.String name, java.lang.String remoteName, boolean append)
          See FileTransfer interface for method description.
 void uploadDir(java.io.File localDir)
          See FileTransfer interface for method description.
 void uploadDir(java.io.File localDir, int retryLimit, boolean performChecksum, java.lang.String extension)
          Uploads local directory and contents.
 void uploadDir(java.io.File localDir, int retryLimit, boolean performChecksum, java.lang.String extension, int threadCount)
          Upload directory.
 void uploadDir(java.io.File localDir, java.lang.String extension)
          Uploads local directory and contents recursively to server.
 java.lang.String uploadUnique(java.io.File file)
          See FileTransfer interface for method description.
 java.lang.String uploadUnique(java.io.InputStream in, java.lang.String fileName)
          See FileTransfer interface for method description.
 java.lang.String uploadUnique(java.lang.String fileName)
          See FileTransfer interface for method description.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FtpsTransfer

public FtpsTransfer()
             throws FileTransferException
Creates FtpsTransfer instance.

Throws:
FileTransferException - FileTransferException instance

FtpsTransfer

public FtpsTransfer(java.lang.String host,
                    java.lang.String user,
                    java.lang.String pwd)
             throws FileTransferException
Creates FtpsTransfer instance.

Parameters:
host - the hostname of FTP server
user - the username of FTP user
pwd - the password of FTP user
Throws:
FileTransferException

FtpsTransfer

public FtpsTransfer(java.lang.String host,
                    java.lang.String user,
                    java.lang.String pwd,
                    int port)
Creates FtpsTransfer instance.

Parameters:
host - the hostname of FTP server
user - the username of FTP user
pwd - the password of FTP user
port - the port of FTP server

FtpsTransfer

public FtpsTransfer(java.lang.String host,
                    java.lang.String user,
                    java.lang.String pwd,
                    java.lang.Integer port)
             throws FileTransferException
Method FtpsTransfer

Parameters:
host -
user -
pwd -
port -
Throws:
FileTransferException

FtpsTransfer

public FtpsTransfer(java.lang.String host,
                    java.lang.String user,
                    java.lang.String pwd,
                    java.io.File localDirectory)
             throws FileTransferException
Creates FtpsTransfer instance.

Parameters:
host - the hostname of FTP server
user - the username of FTP user
pwd - the password of FTP user
localDirectory - the local directory to be used for uploading / downloading files
Throws:
FileTransferException
Method Detail

addFtpsCertificateVerifier

public void addFtpsCertificateVerifier(FtpsCertificateVerifier listener)
Set certificate verifier handle acceptance of SSL certificate.

Parameters:
listener - a FtpsCertificateVerifier
See Also:
FtpsCertificateVerifier

connect

public void connect()
             throws FileTransferException
See FileTransfer interface for method description.

Specified by:
connect in interface FileTransfer
Throws:
FileTransferException - if an I/O or server error occurs.
See Also:
FileTransfer.connect()

clearCommandChannel

public void clearCommandChannel()
                         throws FileTransferException
Clears command channel.

Throws:
FileTransferException

setCompression

public void setCompression(boolean compression)
Sets whether the data will be compressed during the transfering.

Parameters:
compression - When it is true the data will be compressed before it is sent between the client and the server.

connect

public void connect(boolean login)
             throws FileTransferException
Establishes a connection with FTP server with optional login

Parameters:
login - true to login, false otherwise
Throws:
FileTransferException

login

public void login()
           throws FileTransferException
Logs into FTP server after establishing a connection. This method should only be used if login is not performed automatically during connect.

Throws:
FileTransferException - if an I/O or FTP error occurs

issueCommand

public void issueCommand(java.lang.String command)
                  throws FileTransferException
Issues command to the server.

Parameters:
command - a command
Throws:
FileTransferException - if an error occurs

changePassword

public void changePassword(java.lang.String oldPassword,
                           java.lang.String newPassword)
                    throws FileTransferException
Changes the password.

Parameters:
oldPassword - The old password.
newPassword - The new password.
Throws:
FileTransferException - FileTransferException if underlayed I/O or FTP error occurs.

deleteDir

public void deleteDir(java.lang.String name)
               throws FileTransferException
See FileTransfer interface for method description.

Specified by:
deleteDir in interface FileTransfer
Parameters:
name - the directory to remove
Throws:
FileTransferException - if an I/O or server error occurs.
See Also:
FileTransfer.deleteDir(String)

deleteDir

public void deleteDir(java.lang.String name,
                      boolean recursive)
               throws FileTransferException
See FileTransfer interface for method description.

Specified by:
deleteDir in interface FileTransfer
Parameters:
name - the directory to remove
recursive - true if it should delete files and subdirectories within directory
Throws:
FileTransferException - if an I/O or server error occurs.
See Also:
FileTransfer.deleteDir(String, boolean)

deleteFile

public void deleteFile(java.lang.String remoteFile)
                throws FileTransferException
See FileTransfer interface for method description.

Specified by:
deleteFile in interface FileTransfer
Parameters:
remoteFile - name of file to delete
Throws:
FileTransferException - if an I/O or server error occurs.
See Also:
FileTransfer.deleteFile(String)

disconnect

public void disconnect()
                throws FileTransferException
See FileTransfer interface for method description.

Specified by:
disconnect in interface FileTransfer
Throws:
FileTransferException - if an I/O or server error occurs.
See Also:
FileTransfer.disconnect()

download

public void download(java.io.OutputStream out,
                     java.lang.String remoteFile)
              throws FileTransferException
See FileTransfer interface for method description.

Specified by:
download in interface FileTransfer
Parameters:
out - the OutputStream to write download to
remoteFile - remote filename
Throws:
FileTransferException - if an I/O or server error occurs.
See Also:
FileTransfer.download(OutputStream, String)

download

public java.io.File download(java.lang.String remoteFile)
                      throws FileTransferException
See FileTransfer interface for method description.

Specified by:
download in interface FileTransfer
Parameters:
remoteFile - the file to download
Returns:
File the file downloaded
Throws:
FileTransferException - if an I/O or server error occurs.
See Also:
FileTransfer.download(String)

download

public java.io.File download(java.lang.String localFile,
                             java.lang.String remoteFile)
                      throws FileTransferException
See FileTransfer interface for method description.

Specified by:
download in interface FileTransfer
Parameters:
localFile - destination filename
remoteFile - remote filename
Returns:
File the file downloaded
Throws:
FileTransferException - if an I/O or server error occurs.
See Also:
FileTransfer.download(String, String)

downloadDir

public void downloadDir(java.lang.String remoteDir)
                 throws FileTransferException
See FileTransfer interface for method description.

Specified by:
downloadDir in interface FileTransfer
Parameters:
remoteDir - the directory to download
Throws:
FileTransferException - if an I/O or server error occurs.
See Also:
FileTransfer.downloadDir(String)

downloadDir

public void downloadDir(java.lang.String remoteDir,
                        int retryLimit,
                        boolean performChecksum)
                 throws FileTransferException
Downloads remote directory and contents. Downloads are stored relative to current local directory.

Specified by:
downloadDir in interface FileTransfer
Parameters:
remoteDir - the directory to download
retryLimit - Retry number when an error occurs
performChecksum - Checksum perform indicator
Throws:
FtpException - if an I/O or FTP error occurs.
FileTransferException - if an I/O or protocol error occurs.

getDebug

public boolean getDebug()
See FileTransfer interface for method description.

Specified by:
getDebug in interface FileTransfer
Returns:
true if debugging is on
See Also:
FileTransfer.getDebug()

getDebugStream

public java.io.PrintStream getDebugStream()
See FileTransfer interface for method description.

Specified by:
getDebugStream in interface FileTransfer
Returns:
the PrintStream used in reporting debug statements
See Also:
FileTransfer.getDebugStream()

getDir

public java.lang.String getDir()
                        throws FileTransferException
See FileTransfer interface for method description.

Specified by:
getDir in interface FileTransfer
Returns:
current directory
Throws:
FileTransferException - if an I/O or server error occurs.
See Also:
FileTransfer.getDir()

getDirListing

public java.util.Enumeration getDirListing()
                                    throws FileTransferException
See FileTransfer interface for method description.

Specified by:
getDirListing in interface FileTransfer
Returns:
an Enumeration of FileTransferRemoteFile objects
Throws:
FileTransferException - if an I/O or server error occurs.
See Also:
FileTransfer.getDirListing()

getDirListing

public java.util.Enumeration getDirListing(java.lang.String filter)
                                    throws FileTransferException
See FileTransfer interface for method description.

Specified by:
getDirListing in interface FileTransfer
Parameters:
filter - the filename filter
Returns:
an Enumeration of FileTransferRemoteFile objects
Throws:
FileTransferException - if an I/O or server error occurs.
See Also:
FileTransfer.getDirListing(String)

getDirListingAsString

public java.lang.String getDirListingAsString()
                                       throws FileTransferException
See FileTransfer interface for method description.

Specified by:
getDirListingAsString in interface FileTransfer
Returns:
a directory listing
Throws:
FileTransferException - if an I/O or server error occurs.
See Also:
FileTransfer.getDirListingAsString()

getDirListingAsString

public java.lang.String getDirListingAsString(java.lang.String filter)
                                       throws FileTransferException
See FileTransfer interface for method description.

Specified by:
getDirListingAsString in interface FileTransfer
Parameters:
filter - a filename filter
Returns:
a directory listing
Throws:
FileTransferException - if an I/O or server error occurs.
See Also:
FileTransfer.getDirListingAsString(String)

getFilesize

public long getFilesize(java.lang.String remoteFile)
                 throws FileTransferException
See FileTransfer interface for method description.

Specified by:
getFilesize in interface FileTransfer
Parameters:
remoteFile - the remote file
Returns:
filesize in bytes
Throws:
FileTransferException - if an I/O or protocol error occurs.
See Also:
FileTransfer.getFilesize(String)

getFileTimestamp

public java.util.Date getFileTimestamp(java.lang.String remoteFile)
                                throws FileTransferException
See FileTransfer interface for method description.

Specified by:
getFileTimestamp in interface FileTransfer
Parameters:
remoteFile - the remote file
Returns:
date the date/timestamp of remote file
Throws:
FileTransferException - if an I/O or server error occurs.
See Also:
FileTransfer.getFileTimestamp(String)

setFileTimestamp

public void setFileTimestamp(java.lang.String remoteFile,
                             java.util.Date dateFile)
                      throws FileTransferException
See FileTransfer interface for method description.

Specified by:
setFileTimestamp in interface FileTransfer
Parameters:
remoteFile - the remote file
dateFile - the new date/timestamp
Throws:
FileTransferException - if an I/O or server error occurs.
See Also:
FileTransfer.setFileTimestamp(String,Date)

getHostname

public java.lang.String getHostname()
See FileTransfer interface for method description.

Specified by:
getHostname in interface FileTransfer
Returns:
hostname
See Also:
FileTransfer.getHostname()

getLocalDir

public java.io.File getLocalDir()
See FileTransfer interface for method description.

Specified by:
getLocalDir in interface FileTransfer
Returns:
the local directory
See Also:
FileTransfer.getLocalDir()

getLocalDirListing

public java.util.Enumeration getLocalDirListing()
See FileTransfer interface for method description.

Specified by:
getLocalDirListing in interface FileTransfer
Returns:
an java.util.Enumeration of File
See Also:
FileTransfer.getLocalDirListing()

getMode

public int getMode()
See FileTransfer interface for method description.

Specified by:
getMode in interface FileTransfer
Returns:
the data transfer mode
See Also:
FileTransfer.getMode()

getNameListing

public java.util.Enumeration getNameListing()
                                     throws FileTransferException
See FileTransfer interface for method description.

Specified by:
getNameListing in interface FileTransfer
Returns:
an Enumeration of String where each item represents a file or directory name
Throws:
FileTransferException - if an I/O or server related error occurs
See Also:
FileTransfer.getNameListing()

getNameListing

public java.util.Enumeration getNameListing(java.lang.String filter)
                                     throws FileTransferException
See FileTransfer interface for method description.

Specified by:
getNameListing in interface FileTransfer
Parameters:
filter - the filename filter
Returns:
an Enumeration of String where each item represents a file or directory name
Throws:
FileTransferException - if an I/O or server related error occurs
See Also:
FileTransfer.getNameListing(String)

getPassive

public boolean getPassive()
See FileTransfer interface for method description.

Specified by:
getPassive in interface FileTransfer
Returns:
true if passive mode is used, false otherwise
See Also:
FileTransfer.getPassive()

getPassword

public java.lang.String getPassword()
See FileTransfer interface for method description.

Specified by:
getPassword in interface FileTransfer
Returns:
the password
See Also:
FileTransfer.getPassword()

getPort

public int getPort()
See FileTransfer interface for method description.

Specified by:
getPort in interface FileTransfer
Returns:
server port
See Also:
FileTransfer.getPort()

getTimeout

public long getTimeout()
See FileTransfer interface for method description.

Specified by:
getTimeout in interface FileTransfer
Returns:
timeout in milliseconds
See Also:
FileTransfer.getTimeout()

getUsername

public java.lang.String getUsername()
See FileTransfer interface for method description.

Specified by:
getUsername in interface FileTransfer
Returns:
username
See Also:
FileTransfer.getUsername()

interrupt

public void interrupt()
See FileTransfer interface for method description.

Specified by:
interrupt in interface FileTransfer
See Also:
FileTransfer.interrupt()

interrupted

public boolean interrupted()
See FileTransfer interface for method description.

Specified by:
interrupted in interface FileTransfer
Returns:
true if transfer process was interrupted.
See Also:
FileTransfer.interrupted()

isConnected

public boolean isConnected()
See FileTransfer interface for method description.

Specified by:
isConnected in interface FileTransfer
Returns:
true if connected false otherwise
See Also:
FileTransfer.isConnected()

makeDir

public void makeDir(java.lang.String name)
             throws FileTransferException
See FileTransfer interface for method description.

Specified by:
makeDir in interface FileTransfer
Parameters:
name - name of directory to make
Throws:
FileTransferException - if an I/O or server error occurs.
See Also:
FileTransfer.makeDir(String)

makeDirRecursive

public void makeDirRecursive(java.lang.String name)
                      throws FileTransferException
See FileTransfer interface for method description.

Specified by:
makeDirRecursive in interface FileTransfer
Parameters:
name - full path of directory to make
Throws:
FileTransferException - if an I/O or server error occurs
See Also:
FileTransfer.makeDirRecursive(String)

mdelete

public void mdelete(java.lang.String filter)
             throws FileTransferException
Deletes multiple files matching filter to FTP server's current directory. Wildcards may be used to specify multiple files e.g. .*\.txt

Specified by:
mdelete in interface FileTransfer
Parameters:
filter - the regular expression filter to use
Throws:
FileTransferException - if an I/O or FTP error occurs.

makeLocalDir

public java.io.File makeLocalDir(java.lang.String name)
See FileTransfer interface for method description.

Specified by:
makeLocalDir in interface FileTransfer
Parameters:
name - name of directory
Returns:
the directory
See Also:
FileTransfer.makeLocalDir(String)

mdownload

public void mdownload(java.util.Enumeration fileNames)
               throws FileTransferException
See FileTransfer interface for method description.

Specified by:
mdownload in interface FileTransfer
Parameters:
fileNames - filenames of files to download
Throws:
FileTransferException - if an I/O or server error occurs.
See Also:
FileTransfer.mdownload(Enumeration)

mdownload

public void mdownload(java.lang.String filter)
               throws FileTransferException
See FileTransfer interface for method description.

Specified by:
mdownload in interface FileTransfer
Parameters:
filter - the regular expression to use
Throws:
FileTransferException - if an I/O or server error occurs.
See Also:
FileTransfer.mdownload(String)

mupload

public void mupload(java.util.Enumeration fileNames)
             throws FileTransferException
See FileTransfer interface for method description.

Specified by:
mupload in interface FileTransfer
Parameters:
fileNames - filenames of files to upload
Throws:
FileTransferException - if an I/O or server error occurs.
See Also:
FileTransfer.mupload(Enumeration)

mupload

public void mupload(java.lang.String filter)
             throws FileTransferException
See FileTransfer interface for method description.

Specified by:
mupload in interface FileTransfer
Parameters:
filter - the regular expression to use
Throws:
FileTransferException - if an I/O or server error occurs.
See Also:
FileTransfer.mupload(String)

renameFile

public void renameFile(java.lang.String remoteFile,
                       java.lang.String newFile)
                throws FileTransferException
See FileTransfer interface for method description.

Specified by:
renameFile in interface FileTransfer
Parameters:
remoteFile - name of file to rename
newFile - new name of file
Throws:
FileTransferException - if an I/O or server error occurs.
See Also:
FileTransfer.renameFile(String, String)

reset

public void reset()
See FileTransfer interface for method description.

Specified by:
reset in interface FileTransfer
See Also:
FileTransfer.reset()

resumeDownload

public void resumeDownload(java.lang.String remoteFile,
                           long offset)
                    throws FileTransferException
See FileTransfer interface for method description.

Specified by:
resumeDownload in interface FileTransfer
Parameters:
remoteFile - the file to download
offset - file offset in bytes
Throws:
FileTransferException - if an I/O or server error occurs.
See Also:
FileTransfer.resumeDownload(String, long)

resumeDownload

public void resumeDownload(java.lang.String localFile,
                           java.lang.String remoteFile,
                           long offset)
                    throws FileTransferException
See FileTransfer interface for method description.

Specified by:
resumeDownload in interface FileTransfer
Parameters:
localFile - local file name
remoteFile - the file to download
offset - file offset in bytes
Throws:
FileTransferException - if an I/O or server error occurs.
See Also:
FileTransfer.resumeDownload(String, String, long)

resumeUpload

public void resumeUpload(java.io.File file,
                         long offset)
                  throws FileTransferException
See FileTransfer interface for method description.

Specified by:
resumeUpload in interface FileTransfer
Parameters:
file - the local file to upload
offset - file offset in bytes
Throws:
FileTransferException - if an I/O or server error occurs.
See Also:
FileTransfer.resumeUpload(File, long)

resumeUpload

public void resumeUpload(java.lang.String file,
                         long offset)
                  throws FileTransferException
See FileTransfer interface for method description.

Specified by:
resumeUpload in interface FileTransfer
Parameters:
file - the local file to upload
offset - file offset in bytes
Throws:
FileTransferException - if an I/O or server error occurs.
See Also:
FileTransfer.resumeUpload(String, long)

setAscii

public void setAscii()
              throws FileTransferException
See FileTransfer interface for method description.

Specified by:
setAscii in interface FileTransfer
Throws:
FileTransferException - if an I/O or server error occurs.
See Also:
FileTransfer.setAscii()

setAuto

public void setAuto(boolean auto)
             throws FileTransferException
See FileTransfer interface for method description.

Specified by:
setAuto in interface FileTransfer
Parameters:
auto - true to turn automatic detect on false to turn off
Throws:
FileTransferException - if an I/O or server error occurs.
See Also:
FileTransfer.setAuto(boolean)

setBinary

public void setBinary()
               throws FileTransferException
See FileTransfer interface for method description.

Specified by:
setBinary in interface FileTransfer
Throws:
FileTransferException - if an I/O or server error occurs.
See Also:
FileTransfer.setBinary()

setDebug

public void setDebug(boolean debug)
See FileTransfer interface for method description.

Specified by:
setDebug in interface FileTransfer
Parameters:
debug - true to turn debugging on
See Also:
FileTransfer.setDebug(boolean)

setDebugStream

public void setDebugStream(java.io.PrintStream ps)
See FileTransfer interface for method description.

Specified by:
setDebugStream in interface FileTransfer
Parameters:
ps - the PrintStream to send debug statements to
See Also:
FileTransfer.setDebugStream(PrintStream)

setDir

public void setDir(java.lang.String name)
            throws FileTransferException
See FileTransfer interface for method description.

Specified by:
setDir in interface FileTransfer
Parameters:
name - the remote directory
Throws:
FileTransferException - if an I/O or server error occurs.
See Also:
FileTransfer.setDir(String)

setDirUp

public void setDirUp()
              throws FileTransferException
See FileTransfer interface for method description.

Specified by:
setDirUp in interface FileTransfer
Throws:
FileTransferException - if an I/O or server error occurs.
See Also:
FileTransfer.setDirUp()

setErrorOnSizeCommand

public void setErrorOnSizeCommand(boolean error)
Sets the indicator value which will be used by methods that invokes getFileSize.

Parameters:
error - Error indicator value

getErrorOnSizeCommand

public boolean getErrorOnSizeCommand()
Gets the error on size command indicator.

Returns:
true then method which invokes getFileSize will throw an exception when it caused an error, false the error will be ignored.

setHostname

public void setHostname(java.lang.String host)
See FileTransfer interface for method description.

Specified by:
setHostname in interface FileTransfer
Parameters:
host - the hostname or IP address of server
See Also:
FileTransfer.setHostname(String)

setPort

public void setPort(int port)
See FileTransfer interface for method description.

Specified by:
setPort in interface FileTransfer
Parameters:
port - the port
See Also:
FileTransfer.setPort(int)

setLocalDir

public void setLocalDir(java.io.File dir)
See FileTransfer interface for method description.

Specified by:
setLocalDir in interface FileTransfer
Parameters:
dir - the local directory
See Also:
FileTransfer.setLocalDir(File)

setNATAddress

public void setNATAddress(java.lang.String ipAddress)
                   throws FileTransferException
Sets a NAT address which will be used after PASV command.

Parameters:
ipAddress - The NAT IP address.
Throws:
FtpException - If an error occurs.
FileTransferException

setPassive

public void setPassive(boolean passive)
See FileTransfer interface for method description.

Specified by:
setPassive in interface FileTransfer
Parameters:
passive - if true, the transfers will be passive.
See Also:
FileTransfer.setPassive(boolean)

setPassword

public void setPassword(java.lang.String password)
See FileTransfer interface for method description.

Specified by:
setPassword in interface FileTransfer
Parameters:
password - the password
See Also:
FileTransfer.setPassword(String)

setClientCertificates

public void setClientCertificates(java.security.KeyStore keystore,
                                  java.lang.String password)
                           throws FileTransferException
Sets optional client certificate keystore for use during authentication.

Parameters:
keystore - the client keystore
password - the keystore password
Throws:
FileTransferException - if an I/O error occurs

setClientCertificates

public void setClientCertificates(java.lang.String filename,
                                  java.lang.String password)
                           throws FileTransferException
Sets optional client certificate to be used during authentication. Default expected keystore format is JKS format. Existing certificate may be imported into keystore using the keytool utility provided in the Sun JDK.

Example:

  keytool.exe -import -file x509.cer -keystore your_store_name
 

The example above imports the certificate x509.cer into a keystore named your_store_name

Parameters:
filename - the keystore file containing the client certificate
password - the keystore password
Throws:
FileTransferException - if an I/O error occurs

setClientCertificates

public void setClientCertificates(java.lang.String filename,
                                  java.lang.String password,
                                  java.lang.String storetype)
                           throws FileTransferException
Sets optional client certificate to be used during authentication. Default expected keystore format is JKS format. Existing certificate may be imported into keystore using the keytool utility provided in the Sun JDK.

Example:

  keytool.exe -import -file x509.cer -keystore your_store_name
 

The example above imports the certificate x509.cer into a keystore named your_store_name

Parameters:
filename - the keystore file containing the client certificate
password - the keystore password
storetype - the keystore type valid values include jks and pkcs12
Throws:
FileTransferException - if an I/O error occurs

setServerCertificates

public void setServerCertificates(java.security.KeyStore keystore)
                           throws FileTransferException
Sets optional server certificate keystore to use during authentication.

Parameters:
keystore - the keystore
Throws:
FileTransferException - if an I/O error occurs

setServerCertificates

public void setServerCertificates(java.lang.String filename,
                                  java.lang.String password)
                           throws FileTransferException
Sets optional server certificate to be used during authentication. Default expected keystore format is JKS format. Existing certificate may be imported into keystore using the keytool utility provided in the Sun JDK.

Example:

  keytool.exe -import -file x509.cer -keystore your_store_name
 

The example above imports the certificate x509.cer into a keystore named your_store_name

Parameters:
filename - the keystore file containing the server certificate
password - the keystore password
Throws:
FileTransferException - if an I/O error occurs

setServerCertificates

public void setServerCertificates(java.lang.String filename,
                                  java.lang.String password,
                                  java.lang.String storetype)
                           throws FileTransferException
Sets optional server certificate to be used during authentication. Default expected keystore format is JKS format. Existing certificate may be imported into keystore using the keytool utility provided in the Sun JDK.

Example:

  keytool.exe -import -file x509.cer -keystore your_store_name
 

The example above imports the certificate x509.cer into a keystore named your_store_name

Parameters:
filename - the keystore file containing the server certificate
password - the keystore password
storetype - the keystore type valid values include jks and pkcs12
Throws:
FileTransferException - if an I/O error occurs

setTimeout

public void setTimeout(long timeout)
See FileTransfer interface for method description.

Specified by:
setTimeout in interface FileTransfer
Parameters:
timeout - the timeout in milliseconds
See Also:
FileTransfer.setTimeout(long)

setUsername

public void setUsername(java.lang.String username)
See FileTransfer interface for method description.

Specified by:
setUsername in interface FileTransfer
Parameters:
username - the username
See Also:
FileTransfer.setUsername(String)

setUseEPSV

public void setUseEPSV(boolean useEPSV)
Sets use EPSV indicator. When it is true then will be sent EPSV.

Parameters:
useEPSV - The use EPSV value

setUseEPRT

public void setUseEPRT(boolean useEPRT)
Set use EPRT.

Parameters:
useEPRT -

setAutoDetectIpv6

public void setAutoDetectIpv6(boolean autoDetect)
Set auto detect Ipv6.

Parameters:
useIpv6 -

setUseExtendedDirectoryListing

public void setUseExtendedDirectoryListing(boolean useExtendedDirectoryListing)
Sets the use extended directory listing field.

Parameters:
useExtendedDirectoryListing - The use extended directory listing indicator.

getUseEPSV

public boolean getUseEPSV()
Gets use EPSV value.

Returns:
true the passive mode will be sent EPSV command

getUseEPRT

public boolean getUseEPRT()
Gets use EPRT value.

Returns:
true active mode will be sent EPRT command

getAutoDetectIpv6

public boolean getAutoDetectIpv6()
Get auto detect Ipv6.

Returns:
true if auto-detect Ipv6 is set to true

setConnectBeforeCommand

public void setConnectBeforeCommand(boolean before)
Sets the connectBefore property value

Parameters:
before - indicates if the connection will be established before send the command in passive mode

setWireEncoding

public void setWireEncoding(java.lang.String encoding)
Sets encoding set used when issuing commands and transferring files. The default encoding is UTF8

Specified by:
setWireEncoding in interface FileTransfer
Parameters:
encoding - the character encoding to be used

getWireEncoding

public java.lang.String getWireEncoding()
Gets encoding set used when issuing commands and transferring files

Specified by:
getWireEncoding in interface FileTransfer
Returns:
Returns the encoding is being used

getRemoteFileChecksum

public java.lang.String getRemoteFileChecksum(java.lang.String remoteFile)
                                       throws FtpException
Returns remote file checksum.

Parameters:
remoteFile - remote file
Returns:
remote file checksum.
Throws:
FtpException - if an error occurs

getLocalChecksum

public java.lang.String getLocalChecksum(java.io.File localFile)
                                  throws FtpException
Returns local checksum.

Parameters:
localFile - File which will be calculate the checksum
Returns:
checksum Compute value
Throws:
FtpException - if an error occurs

upload

public void upload(byte[] data,
                   java.lang.String name)
            throws FileTransferException
See FileTransfer interface for method description.

Specified by:
upload in interface FileTransfer
Parameters:
data - the raw contents of the file to upload
name - the filename to store file as on FTP server
Throws:
FileTransferException - if an I/O or server related error occurs
See Also:
FileTransfer.upload(byte[], String)

upload

public void upload(byte[] data,
                   java.lang.String name,
                   boolean append)
            throws FileTransferException
See FileTransfer interface for method description.

Specified by:
upload in interface FileTransfer
Parameters:
data - the raw contents of the file to upload
name - the filename to store file as on server
append - true to append to remote file on FTP server, false otherwise
Throws:
FileTransferException - if an I/O or server related error occurs
See Also:
FileTransfer.upload(byte[], String, boolean)

upload

public void upload(java.io.File file)
            throws FileTransferException
See FileTransfer interface for method description.

Specified by:
upload in interface FileTransfer
Parameters:
file - the local file to upload
Throws:
FileTransferException - if an I/O or server related error occurs
See Also:
FileTransfer.upload(File)

upload

public void upload(java.io.File file,
                   boolean append)
            throws FileTransferException
See FileTransfer interface for method description.

Specified by:
upload in interface FileTransfer
Parameters:
file - the local file to upload
append - true to append to remote file on server, false otherwise
Throws:
FileTransferException - if an I/O or server related error occurs
See Also:
FileTransfer.upload(File, boolean)

upload

public void upload(java.lang.String extension,
                   java.io.File file)
            throws FileTransferException
Uploads a file to server with the extension specified by the argument. After the file has been uploaded then the file name is renamed to the original file name.

Specified by:
upload in interface FileTransfer
Parameters:
extension - The extension file will be used to upload the file.
file - The file will be uploaded
Throws:
FileTransferException

upload

public void upload(java.io.File file,
                   java.lang.String remoteName)
            throws FileTransferException
See FileTransfer interface for method description.

Specified by:
upload in interface FileTransfer
Parameters:
file - the local file to upload
remoteName - the destination filename of upload
Throws:
FileTransferException - if an I/O or server related error occurs
See Also:
FileTransfer.upload(File, String)

upload

public void upload(java.io.File file,
                   java.lang.String remoteName,
                   boolean append)
            throws FileTransferException
See FileTransfer interface for method description.

Specified by:
upload in interface FileTransfer
Parameters:
file - the local file to upload
remoteName - the destination filename of upload
append - true to append to remote file on server, false otherwise
Throws:
FileTransferException - if an I/O or server related error occurs
See Also:
FileTransfer.upload(File, String, boolean)

upload

public void upload(java.lang.String name)
            throws FileTransferException
See FileTransfer interface for method description.

Specified by:
upload in interface FileTransfer
Parameters:
name - the local file to upload
Throws:
FileTransferException - if an I/O or server error occurs.
See Also:
FileTransfer.upload(String)

upload

public void upload(java.lang.String name,
                   boolean append)
            throws FileTransferException
See FileTransfer interface for method description.

Specified by:
upload in interface FileTransfer
Parameters:
name - the local file to upload
append - true to append to remote file on server, false otherwise
Throws:
FileTransferException - if an I/O or server error occurs.
See Also:
FileTransfer.upload(String, boolean)

upload

public void upload(java.lang.String name,
                   java.lang.String remoteName)
            throws FileTransferException
See FileTransfer interface for method description.

Specified by:
upload in interface FileTransfer
Parameters:
name - the local file to upload
remoteName - the destination of upload
Throws:
FileTransferException - if an I/O or server error occurs.
See Also:
FileTransfer.upload(String, String)

upload

public void upload(java.lang.String name,
                   java.lang.String remoteName,
                   boolean append)
            throws FileTransferException
See FileTransfer interface for method description.

Specified by:
upload in interface FileTransfer
Parameters:
name - the local file to upload
remoteName - the destination of upload
append - true to append to remote file on FTP server, false otherwise
Throws:
FileTransferException - if an I/O or server error occurs.
See Also:
FileTransfer.upload(String, String, boolean)

uploadUnique

public java.lang.String uploadUnique(java.lang.String fileName)
                              throws FileTransferException
See FileTransfer interface for method description.

Specified by:
uploadUnique in interface FileTransfer
Parameters:
fileName - the file to be uploaded relative to current local directory
Returns:
the resulting unique filename on server
Throws:
FileTransferException - if an I/O or protocol error occurs.
See Also:
FileTransfer.uploadUnique(String)

uploadUnique

public java.lang.String uploadUnique(java.io.File file)
                              throws FileTransferException
See FileTransfer interface for method description.

Specified by:
uploadUnique in interface FileTransfer
Parameters:
file - the file to be uploaded
Returns:
the resulting unique filename on server
Throws:
FileTransferException - if an I/O or protocol error occurs.
See Also:
FileTransfer.uploadUnique(File)

uploadUnique

public java.lang.String uploadUnique(java.io.InputStream in,
                                     java.lang.String fileName)
                              throws FileTransferException
See FileTransfer interface for method description.

Specified by:
uploadUnique in interface FileTransfer
Parameters:
in - the InputStream to upload file from
fileName - the filename to be used as seed value for determining unique filename
Returns:
the resulting unique filename on server
Throws:
FileTransferException - if an I/O or protocol error occurs.
See Also:
FileTransfer.uploadUnique(InputStream,String)

uploadDir

public void uploadDir(java.io.File localDir)
               throws FileTransferException
See FileTransfer interface for method description.

Specified by:
uploadDir in interface FileTransfer
Parameters:
localDir - the directory to upload
Throws:
FileTransferException - if an I/O or protocol error occurs.
See Also:
FileTransfer.uploadDir(File)

uploadDir

public void uploadDir(java.io.File localDir,
                      java.lang.String extension)
               throws FileTransferException
Uploads local directory and contents recursively to server. Uploads are stored relative to current remote directory. Files are uploaded with the extension specified in the argument extension but when the upload has finished the remote file name is renamed to the original file name.

Specified by:
uploadDir in interface FileTransfer
Parameters:
localDir - the directory to upload
extension - The extension file name used to upload each file
Throws:
FileTransferException - if an I/O or FTP error occurs.

uploadDir

public void uploadDir(java.io.File localDir,
                      int retryLimit,
                      boolean performChecksum,
                      java.lang.String extension)
               throws FileTransferException
Uploads local directory and contents. Uploads are stored relative to current remote directory.

Specified by:
uploadDir in interface FileTransfer
Parameters:
localDir - the directory to upload
retryLimit - Retry number when an error occurs
performChecksum - Checksum perform indicator
extension - The extension which will be used to upload the files
Throws:
FtpException - if an I/O or FTP error occurs.
FileTransferException - if an I/O or protocol related error occurs.

addFileTransferListener

public void addFileTransferListener(FileTransferListener listener)
See FileTransfer interface for method description.

Specified by:
addFileTransferListener in interface FileTransfer
Parameters:
listener - the listener to add
See Also:
FileTransfer.addFileTransferListener(FileTransferListener)

removeFileTransferListener

public void removeFileTransferListener(FileTransferListener listener)
See FileTransfer interface for method description.

Specified by:
removeFileTransferListener in interface FileTransfer
Parameters:
listener - the listener to remove
See Also:
FileTransfer.removeFileTransferListener(FileTransferListener)

getInputStream

public java.io.InputStream getInputStream(java.lang.String remoteFile,
                                          long pos)
                                   throws FileTransferException
Description copied from interface: FileTransfer
Gets InputStream for remote file for reading.

Specified by:
getInputStream in interface FileTransfer
Parameters:
remoteFile - the remote file to get InputStream for
pos - the byte offset, 0 to get full file
Returns:
an InputStream
Throws:
FileTransferException - if an I/O or protocol related error occurs

getImplementation

public java.lang.Object getImplementation()
See FileTransfer interface for method description.

Specified by:
getImplementation in interface FileTransfer
Returns:
underlying file transfer implementation
See Also:
Ftp, Ftps

getOutputStream

public java.io.OutputStream getOutputStream(java.lang.String fileName,
                                            long off,
                                            boolean append)
                                     throws FileTransferException
Description copied from interface: FileTransfer
Gets OutputStream for writing to remote file.

Specified by:
getOutputStream in interface FileTransfer
Parameters:
fileName - the remote filename
off - the byte offset, 0 to write at beginning of file
append - true to append to remote file, false otherwise
Returns:
an OutputStream
Throws:
FileTransferException - if an I/O or protocol related error occurs

setBlockTransferSize

public void setBlockTransferSize(int blocksize)
Sets block size for use in transferring files.

Specified by:
setBlockTransferSize in interface FileTransfer
Parameters:
blocksize - the blocksize in bytes

getBlockTransferSize

public int getBlockTransferSize()
Gets blocksize for use in transferring files.

Specified by:
getBlockTransferSize in interface FileTransfer
Returns:
blocksize in bytes

setShutdownCCC

public void setShutdownCCC(boolean shutdownCCC)
Sets whether SSL connection should be shutdown after successfully issuing CCC command. Default is true.

Parameters:
shutdownCCC - true to shutdown, false otherwise

getShutdownCCC

public boolean getShutdownCCC()
Gets whether SSL connection should be shutdown after successfully issuing CCC command. Default is true.

Returns:
true to shutdown, false otherwise

setProxyAuthentication

public void setProxyAuthentication(java.lang.String proxyUsername,
                                   java.lang.String proxyPassword)
Sets the proxy authentication username and password to use with proxy server. To clear these settings invoke the #clearProxySettings method.

Specified by:
setProxyAuthentication in interface FileTransfer
Parameters:
proxyUsername - the proxy username
proxyPassword - the proxy password
See Also:
clearProxySettings()

setProxyHost

public void setProxyHost(java.lang.String proxyHostname,
                         int proxyPort)
Sets the proxy hostname and port for this connection. To clear these settings invoke the #clearProxySettings method.

Specified by:
setProxyHost in interface FileTransfer
Parameters:
proxyHostname - the hostname or ip address of the proxy server
proxyPort - the port of the proxy server to connect to
See Also:
clearProxySettings()

setProxyType

public void setProxyType(java.lang.String proxyType)
Sets the proxy type will be used for this connection.

Specified by:
setProxyType in interface FileTransfer
Parameters:
proxyType - The proxy type. Values allowed: HTTP, SOCKS5

clearProxySettings

public void clearProxySettings()
Clears proxy server values.

Specified by:
clearProxySettings in interface FileTransfer

isFeatureSupported

public boolean isFeatureSupported(java.lang.String command)
                           throws FileTransferException
Throws:
FileTransferException

checksum

public void checksum(java.io.File localFile,
                     java.lang.String remoteFile)
              throws FileTransferException
Throws:
FileTransferException

abortDownloadThreads

public void abortDownloadThreads()
Abort download threads.

Specified by:
abortDownloadThreads in interface FileTransfer

abortUploadThreads

public void abortUploadThreads()
Abort upload threads.

Specified by:
abortUploadThreads in interface FileTransfer

downloadDir

public void downloadDir(java.lang.String remoteDir,
                        int retryLimit,
                        boolean performChecksum,
                        int threadCount)
                 throws FileTransferException
Download directory.

Specified by:
downloadDir in interface FileTransfer
Parameters:
remoteDir - the directory to download
retryLimit - retry limit if download fails
performChecksum - whether or not to perform checksum after download, only supported in FTP/S protocols and not by all FTP servers
threadCount - the thread count
Throws:
FileTransferException - if an I/O or protocol error occurs.

getRemoteFileList

public java.util.Vector getRemoteFileList(java.lang.String directory)
                                   throws FileTransferException
Get remote file list.

Specified by:
getRemoteFileList in interface FileTransfer
Throws:
FileTransferException

getRecursiveDirectoryFileCount

public int getRecursiveDirectoryFileCount(java.lang.String directory)
Get recursive file count.

Specified by:
getRecursiveDirectoryFileCount in interface FileTransfer

getRecursiveDirectorySize

public long getRecursiveDirectorySize(java.lang.String directory)
Get recursive directory size.

Specified by:
getRecursiveDirectorySize in interface FileTransfer

uploadDir

public void uploadDir(java.io.File localDir,
                      int retryLimit,
                      boolean performChecksum,
                      java.lang.String extension,
                      int threadCount)
               throws FileTransferException
Upload directory.

Specified by:
uploadDir in interface FileTransfer
Parameters:
localDir - the directory to upload
retryLimit - retry number when an error occurs
performChecksum - whether or not to perform checksum verification
extension - the temporary extension which will be used when uploading files or null to use current extension
Throws:
FileTransferException - if an I/O or protocol related error occurs.

Secure FTP Factory

Copyright © JSCAPE LLC. 1999-2011. All Rights Reserved