Secure iNet Factory

com.jscape.filetransfer
Class FtpsTransfer

java.lang.Object
  extended bycom.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 addFileTransferListener(FileTransferListener listener)
          See FileTransfer interface for method description.
 void addFtpsCertificateVerifier(FtpsCertificateVerifier listener)
          Adds certificate verifier handle acceptance of SSL certificate.
 void changePassword(java.lang.String oldPassword, java.lang.String newPassword)
          Changes the password.
 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.
 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.
 java.lang.String getRemoteFileChecksum(java.lang.String remoteFile)
          Returns remote file checksum.
 boolean getShutdownCCC()
          Gets whether SSL connection should be shutdown after successfully issuing CCC command.
 int getTimeout()
          See FileTransfer interface for method description.
 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.
 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 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(int timeout)
          See FileTransfer interface for method description.
 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, 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 com.jscape.filetransfer.FileTransferException
Creates FtpsTransfer instance.

Throws:
com.jscape.filetransfer.FileTransferException

FtpsTransfer

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

Parameters:
host - the hostname of FTP server
user - the username of FTP user
pwd - the password of FTP user
Throws:
com.jscape.filetransfer.FileTransferException

FtpsTransfer

public FtpsTransfer(java.lang.String host,
                    java.lang.String user,
                    java.lang.String pwd,
                    int port)
             throws com.jscape.filetransfer.FileTransferException
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
Throws:
com.jscape.filetransfer.FileTransferException

FtpsTransfer

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

Parameters:
host -
user -
pwd -
port -
Throws:
com.jscape.filetransfer.FileTransferException

FtpsTransfer

public FtpsTransfer(java.lang.String host,
                    java.lang.String user,
                    java.lang.String pwd,
                    java.io.File localDirectory)
             throws com.jscape.filetransfer.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:
com.jscape.filetransfer.FileTransferException
Method Detail

addFtpsCertificateVerifier

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

Parameters:
listener - a FtpsCertificateVerifier
See Also:
FtpsCertificateVerifier

connect

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

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

clearCommandChannel

public void clearCommandChannel()
                         throws com.jscape.filetransfer.FileTransferException
Clears command channel.

Throws:
com.jscape.filetransfer.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 com.jscape.filetransfer.FileTransferException
Establishes a connection with FTP server with optional login

Parameters:
login - true to login, false otherwise
Throws:
com.jscape.filetransfer.FileTransferException

login

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

Throws:
com.jscape.filetransfer.FileTransferException - if an I/O or FTP error occurs

changePassword

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

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

deleteDir

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

Specified by:
deleteDir in interface FileTransfer
Parameters:
name - the directory to remove
Throws:
com.jscape.filetransfer.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 com.jscape.filetransfer.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:
com.jscape.filetransfer.FileTransferException - if an I/O or server error occurs.
See Also:
FileTransfer.deleteDir(String, boolean)

deleteFile

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

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

disconnect

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

Specified by:
disconnect in interface FileTransfer
Throws:
com.jscape.filetransfer.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 com.jscape.filetransfer.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:
com.jscape.filetransfer.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 com.jscape.filetransfer.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:
com.jscape.filetransfer.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 com.jscape.filetransfer.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:
com.jscape.filetransfer.FileTransferException - if an I/O or server error occurs.
See Also:
FileTransfer.download(String, String)

downloadDir

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

Specified by:
downloadDir in interface FileTransfer
Parameters:
remoteDir - the directory to download
Throws:
com.jscape.filetransfer.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 com.jscape.filetransfer.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.
com.jscape.filetransfer.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 com.jscape.filetransfer.FileTransferException
See FileTransfer interface for method description.

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

getDirListing

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

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

getDirListing

public java.util.Enumeration getDirListing(java.lang.String filter)
                                    throws com.jscape.filetransfer.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:
com.jscape.filetransfer.FileTransferException - if an I/O or server error occurs.
See Also:
FileTransfer.getDirListing(String)

getDirListingAsString

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

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

getDirListingAsString

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

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

getFilesize

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

Specified by:
getFilesize in interface FileTransfer
Parameters:
remoteFile - the remote file
Returns:
filesize in bytes
Throws:
com.jscape.filetransfer.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 com.jscape.filetransfer.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:
com.jscape.filetransfer.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 com.jscape.filetransfer.FileTransferException
See FileTransfer interface for method description.

Specified by:
setFileTimestamp in interface FileTransfer
Parameters:
remoteFile - the remote file
dateFile - the new date/timestamp
Throws:
com.jscape.filetransfer.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 com.jscape.filetransfer.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:
com.jscape.filetransfer.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 com.jscape.filetransfer.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:
com.jscape.filetransfer.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 int 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 com.jscape.filetransfer.FileTransferException
See FileTransfer interface for method description.

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

makeDirRecursive

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

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

mdelete

public void mdelete(java.lang.String filter)
             throws com.jscape.filetransfer.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:
com.jscape.filetransfer.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 com.jscape.filetransfer.FileTransferException
See FileTransfer interface for method description.

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

mdownload

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

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

mupload

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

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

mupload

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

Specified by:
mupload in interface FileTransfer
Parameters:
filter - the regular expression to use
Throws:
com.jscape.filetransfer.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 com.jscape.filetransfer.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:
com.jscape.filetransfer.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 com.jscape.filetransfer.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:
com.jscape.filetransfer.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 com.jscape.filetransfer.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:
com.jscape.filetransfer.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 com.jscape.filetransfer.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:
com.jscape.filetransfer.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 com.jscape.filetransfer.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:
com.jscape.filetransfer.FileTransferException - if an I/O or server error occurs.
See Also:
FileTransfer.resumeUpload(String, long)

setAscii

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

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

setAuto

public void setAuto(boolean auto)
             throws com.jscape.filetransfer.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:
com.jscape.filetransfer.FileTransferException - if an I/O or server error occurs.
See Also:
FileTransfer.setAuto(boolean)

setBinary

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

Specified by:
setBinary in interface FileTransfer
Throws:
com.jscape.filetransfer.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 com.jscape.filetransfer.FileTransferException
See FileTransfer interface for method description.

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

setDirUp

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

Specified by:
setDirUp in interface FileTransfer
Throws:
com.jscape.filetransfer.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 com.jscape.filetransfer.FileTransferException
Sets a NAT address which will be used after PASV command.

Parameters:
ipAddress - The NAT IP address.
Throws:
FtpException - If an error occurs.
com.jscape.filetransfer.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 com.jscape.filetransfer.FileTransferException
Sets optional client certificate keystore for use during authentication.

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

setClientCertificates

public void setClientCertificates(java.lang.String filename,
                                  java.lang.String password)
                           throws com.jscape.filetransfer.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:
com.jscape.filetransfer.FileTransferException - if an I/O error occurs

setClientCertificates

public void setClientCertificates(java.lang.String filename,
                                  java.lang.String password,
                                  java.lang.String storetype)
                           throws com.jscape.filetransfer.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:
com.jscape.filetransfer.FileTransferException - if an I/O error occurs

setServerCertificates

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

Parameters:
keystore - the keystore
Throws:
com.jscape.filetransfer.FileTransferException - if an I/O error occurs

setServerCertificates

public void setServerCertificates(java.lang.String filename,
                                  java.lang.String password)
                           throws com.jscape.filetransfer.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:
com.jscape.filetransfer.FileTransferException - if an I/O error occurs

setServerCertificates

public void setServerCertificates(java.lang.String filename,
                                  java.lang.String password,
                                  java.lang.String storetype)
                           throws com.jscape.filetransfer.FileTransferException
S