com.jscape.filetransfer

## Interface FileTransfer

- All Superinterfaces:
    java.lang.AutoCloseable
  All Known Implementing Classes:
    com.jscape.filetransfer.AbstractFileTransfer, FtpsImplicitTransfer, FtpsTransfer, FtpTransfer, SftpFileTransfer

      public interface FileTransfer
      extends java.lang.AutoCloseable

  Abstract interface for performing file transfer operations using FTP, FTPS (FTP over SSL) and SFTP (FTP over SSH) protocols.

  Example Usage:

       FileTransfer ftp = new FtpFileTransfer(hostname,username,password);
       ftp.connect();
       System.out.println(ftp.getDirListingAsString());
       ftp.disconnect();

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `ASCII` Flag to indicate that ASCII transfer mode is used.
    `static int` | `AUTO` Flag to indicate that automatic transfer mode detection is used.
    `static int` | `BINARY` Flag to indicate that BINARY transfer mode is used.
    `static java.lang.String` | `CURRENT_DIRECTORY` Represents the current directory.
    `static java.lang.String` | `PARENT_DIRECTORY` Represents the parent directory of current directory.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `abortDownloadThread(java.lang.String remoteFile)` Abort download thread.
    `void` | `abortDownloadThreads()` Abort all download threads.
    `void` | `abortUploadThread(java.lang.String remoteFile)` Abort upload thread.
    `void` | `abortUploadThreads()` Abort all upload threads.
    `void` | `addFileTransferListener(FileTransferListener listener)` Adds FileTransferListener.
    `void` | `clearProxySettings()` Clears proxy server values.
    `void` | `close()`
    `FileTransfer` | `connect()` Connects to server and performs login.
    `FileTransfer` | `copy()` Returns a copy of current transfer instance with same listeners.
    `void` | `deleteDir(java.lang.String remoteDirectory)` Deletes directory from server.
    `void` | `deleteDir(java.lang.String remoteDirectory, boolean recursive)` Deletes directory from server.
    `void` | `deleteFile(java.lang.String remoteFile)` Deletes remote file from server.
    `void` | `disconnect()` Quits session and disconnects from server.
    `void` | `download(java.io.OutputStream out, java.lang.String remoteFile)` Downloads file from server and writes contents to provided `OutputStream`.
    `java.io.File` | `download(java.lang.String remoteFile)` Downloads file from server.
    `java.io.File` | `download(java.lang.String localFile, java.lang.String remoteFile)` Downloads file from server.
    `void` | `downloadDir(java.lang.String remoteDirectory)` Downloads remote directory and contents recursively from server.
    `void` | `downloadDir(java.lang.String remoteDirectory, int retryAttempts, boolean checksumVerificationRequired)` Downloads remote directory and contents.
    `void` | `downloadDir(java.lang.String remoteDirectory, int retryAttempts, boolean checksumVerificationRequired, int threadCount)` Downloads remote directory and contents.
    `boolean` | `exists(java.lang.String remotePath)` Checks if the specified path exists on the remote server.
    `int` | `getBlockTransferSize()` Gets blocksize for use in transferring files.
    `boolean` | `getDebug()` Gets debugging state.
    `java.io.PrintStream` | `getDebugStream()` Gets PrintStream used in reporting debug statements.
    `java.lang.String` | `getDir()` Gets current working directory of server.
    `java.util.Enumeration<FileTransferRemoteFile>` | `getDirListing()` Gets directory listing from server.
    `java.util.Enumeration<FileTransferRemoteFile>` | `getDirListing(java.lang.String regex)` Gets file listing of files matching regular expression.
    `java.lang.String` | `getDirListingAsString()` Gets directory listing of files on server.
    `java.lang.String` | `getDirListingAsString(java.lang.String regex)` Gets file listing of files matching regular expression.
    `long` | `getFilesize(java.lang.String remoteFile)` Gets filesize of remote file from server.
    `java.util.Date` | `getFileTimestamp(java.lang.String remoteFile)` Gets date/timestamp of remote file from server.
    `java.lang.String` | `getHostname()` Gets hostname of server.
    `java.lang.Object` | `getImplementation()` Gets underlying file transfer instance.
    `java.io.InputStream` | `getInputStream(java.lang.String remoteFile, long remoteFileOffset)` Gets `InputStream` for remote file for reading.
    `java.io.File` | `getLocalDir()` Gets local directory to be used in session.
    `java.util.Enumeration` | `getLocalDirListing()` Gets local directory listing.
    `int` | `getMode()` Gets data transfer mode for current session.
    `java.util.Enumeration` | `getNameListing()` Gets directory listing of files on server.
    `java.util.Enumeration` | `getNameListing(java.lang.String regex)` Gets directory listing of files on server matching regular expression.
    `java.io.OutputStream` | `getOutputStream(java.lang.String remoteFile, long remoteFileOffset)` Gets `OutputStream` for writing to remote file.
    `boolean` | `getPassive()` Gets whether passive mode is used for FTP connections.
    `java.lang.String` | `getPassword()` Gets password.
    `int` | `getPort()` Gets server port.
    `int` | `getRecursiveDirectoryFileCount(java.lang.String remoteDirectory)` Get recursive directory file count.
    `long` | `getRecursiveDirectorySize(java.lang.String remoteDirectory)` Get recursive directory size.
    `java.util.Vector<FileTransferRemoteFile>` | `getRemoteFileList(java.lang.String remoteDirectory)` Get remote directory list.
    `long` | `getTimeout()` Gets the timeout for opening connection to server.
    `java.lang.String` | `getUsername()` Gets username.
    `java.lang.String` | `getWireEncoding()` Gets encoding set used when issuing commands and transferring files.
    `void` | `interrupt()` Interrupts the current data transfer and sets interrupted flag to `true`.
    `boolean` | `interrupted()` Checks if transfer process was interrupted.
    `boolean` | `isChecksumVerificationRequired()`
    `boolean` | `isConnected()` Checks if client is connected to server.
    `boolean` | `isDirectory(java.lang.String remotePath)`
    `void` | `makeDir(java.lang.String remoteDirectory)` Makes directory on server.
    `void` | `makeDirRecursive(java.lang.String remoteDirectory)` Makes directory on server, creating subdirectories if necessary.
    `java.io.File` | `makeLocalDir(java.lang.String localDirectory)` Creates local directory.
    `void` | `mdelete(java.lang.String regex)` Deletes multiple files in servers current directory matching regular expression.
    `void` | `mdownload(java.util.Enumeration remoteFiles)` Downloads specified files in current working remote directory from server to local directory.
    `void` | `mdownload(java.lang.String regex)` Downloads multiple files matching regular expression from server's current directory.
    `void` | `mupload(java.util.Enumeration localFiles)` Uploads multiple files to server.
    `void` | `mupload(java.lang.String regex)` Uploads multiple files matching regular expression to server's current directory.
    `void` | `removeFileTransferListener(FileTransferListener listener)` Removes specified FileTransferListener.
    `void` | `renameFile(java.lang.String sourceRemoteFile, java.lang.String destinationRemoteFile)` Renames remote file on server.
    `void` | `reset()` Resets the interrupted flag to `false`.
    `void` | `resumeDownload(java.io.OutputStream out, java.lang.String remoteFile, long remoteFileOffset)`
    `void` | `resumeDownload(java.lang.String remoteFile, long remoteFileOffset)` Resumes download of file from server.
    `void` | `resumeDownload(java.lang.String localFile, java.lang.String remoteFile, long remoteFileOffset)` Resumes download of file from server.
    `void` | `resumeUpload(java.io.File localFile, long localFileOffset)` Resumes upload of file to server.
    `void` | `resumeUpload(java.io.File localFile, java.lang.String remoteFile, long localFileOffset)` Resume upload of file to server.
    `void` | `resumeUpload(java.io.InputStream in, long length, java.lang.String remoteFile, long remoteFileOffset)`
    `void` | `resumeUpload(java.lang.String localFile, long localFileOffset)` Resumes upload of file to server.
    `boolean` | `sameChecksum(java.io.File localFile, java.lang.String remoteFile)` Checks a checksum equality of local and remote files.
    `FileTransfer` | `setAscii()` Sets data transfer mode to ASCII.
    `FileTransfer` | `setAuto(boolean value)` Sets data transfer mode to automatically detect transfer mode.
    `FileTransfer` | `setBinary()` Sets data transfer mode to binary.
    `FileTransfer` | `setBlockTransferSize(int value)` Sets block size for use in transferring files.
    `FileTransfer` | `setChecksumVerificationRequired(boolean value)`
    `FileTransfer` | `setDebug(boolean debug)` Sets debugging state.
    `FileTransfer` | `setDebugStream(java.io.PrintStream ps)` Sets `PrintStream` used in reporting debug statements.
    `FileTransfer` | `setDir(java.lang.String remoteDirectory)` Sets current directory on server.
    `FileTransfer` | `setDirUp()` Sets current directory on server to parent directory.
    `FileTransfer` | `setFileModificationTime(java.lang.String remoteFile, java.util.Date modificationTime)` Set file modifcation time.
    `FileTransfer` | `setFileTimestamp(java.lang.String remoteFile, java.util.Date timestamp)` Sets date/timestamp of remote file from server When using the FTP/S protocols the MDTM command is used.
    `FileTransfer` | `setHostname(java.lang.String value)` Sets hostname of server.
    `FileTransfer` | `setLocalDir(java.io.File value)` Sets local directory to be used in session.
    `FileTransfer` | `setPassive(boolean value)` Sets whether passive mode is used for FTP connections.
    `FileTransfer` | `setPassword(java.lang.String value)` Sets password.
    `FileTransfer` | `setPort(int value)` Sets port of remote server.
    `FileTransfer` | `setPreserveFileDownloadTimestamp(boolean value)` Set preserve file download timestamps.
    `FileTransfer` | `setPreserveFileUploadTimestamp(boolean value)` Get preserve file upload timestamps.
    `FileTransfer` | `setProxyAuthentication(java.lang.String username, java.lang.String password)` Sets the proxy authentication username and password to use with proxy server.
    `FileTransfer` | `setProxyHost(java.lang.String host, int port)` Sets the proxy hostname and port for this connection.
    `FileTransfer` | `setProxyType(java.lang.String value)` Sets the proxy type will be used for this connection.
    `FileTransfer` | `setTimeout(long value)` Sets the timeout for opening connection to server.
    `FileTransfer` | `setTimeZone(java.util.TimeZone value)` Set the timezone, used for preserving timestamps.
    `FileTransfer` | `setUsername(java.lang.String value)` Sets username.
    `FileTransfer` | `setWireEncoding(java.lang.String value)` Sets encoding set used when issuing commands and transferring files.
    `void` | `upload(byte[] data, java.lang.String remoteFile)` Uploads file to server where contents of file is not on disk but in memory.
    `void` | `upload(byte[] data, java.lang.String remoteFile, boolean shouldAppend)` Uploads file to server where contents of file is not on disk but in memory.
    `void` | `upload(java.io.File localFile)` Uploads file to server.
    `void` | `upload(java.io.File localFile, boolean shouldAppend)` Uploads file to server.
    `void` | `upload(java.io.File localFile, java.lang.String remoteFile)` Uploads file to server.
    `void` | `upload(java.io.File localFile, java.lang.String remoteFile, boolean shouldAppend)` Uploads file to server.
    `void` | `upload(java.io.InputStream in, long length, java.lang.String remoteFile, boolean shouldAppend)`
    `void` | `upload(java.lang.String localFile)` Uploads file to server.
    `void` | `upload(java.lang.String localFile, boolean shouldAppend)` Uploads file to server.
    `void` | `upload(java.lang.String tempFileExtension, java.io.File localFile)` Uploads file to server with the specified temporary extension.
    `void` | `upload(java.lang.String localFile, java.lang.String remoteFile)` Uploads file to server.
    `void` | `upload(java.lang.String localFile, java.lang.String remoteFile, boolean shouldAppend)` Uploads file to server.
    `void` | `uploadDir(java.io.File localDirectory)` Uploads local directory and contents recursively to server.
    `void` | `uploadDir(java.io.File localDirectory, int retryAttempts, boolean checksumVerificationRequired, java.lang.String tempFileExtension)` Uploads local directory and contents.
    `void` | `uploadDir(java.io.File localDirectory, int retryAttempts, boolean checksumVerificationRequired, java.lang.String tempFileExtension, int threadCount)` Uploads local directory and contents.
    `void` | `uploadDir(java.io.File localDirectory, java.lang.String tempFileExtension)` Uploads local directory and contents recursively to server.
    `java.lang.String` | `uploadUnique(java.io.File localFile)` Uploads the file which is created in the current directory under a name unique to that directory.
    `java.lang.String` | `uploadUnique(java.io.InputStream in, java.lang.String remoteFilePrefix)` Uploads the file which is created in the current directory under a name unique to that directory.
    `java.lang.String` | `uploadUnique(java.lang.String localFile)` Uploads the file which is created in the current directory under a name unique to that directory.

- - ### Field Detail

    - #### AUTO

          static final int AUTO

      Flag to indicate that automatic transfer mode detection is used.
      See Also:
        `getMode()`, Constant Field Values

    - #### ASCII

          static final int ASCII

      Flag to indicate that ASCII transfer mode is used.
      See Also:
        `getMode()`, Constant Field Values

    - #### BINARY

          static final int BINARY

      Flag to indicate that BINARY transfer mode is used.
      See Also:
        `getMode()`, Constant Field Values

    - #### CURRENT_DIRECTORY

          static final java.lang.String CURRENT_DIRECTORY

      Represents the current directory. Value of "."
      See Also:
        Constant Field Values

    - #### PARENT_DIRECTORY

          static final java.lang.String PARENT_DIRECTORY

      Represents the parent directory of current directory. Value of ".."
      See Also:
        Constant Field Values

  - ### Method Detail

    - #### setProxyType

          FileTransfer setProxyType(java.lang.String value)

      Sets the proxy type will be used for this connection.
      Parameters:
        `value` - The proxy type. Values allowed: HTTP, SOCKS5

    - #### setProxyHost

          FileTransfer setProxyHost(java.lang.String host,
                                    int port)

      Sets the proxy hostname and port for this connection. To clear these settings invoke the #clearProxySettings method.
      Parameters:
        `host` - the hostname or ip address of the proxy server
        `port` - the port of the proxy server to connect to
      See Also:
        `clearProxySettings()`

    - #### setProxyAuthentication

          FileTransfer setProxyAuthentication(java.lang.String username,
                                              java.lang.String password)

      Sets the proxy authentication username and password to use with proxy server. To clear these settings invoke the #clearProxySettings method.
      Parameters:
        `username` - the proxy username
        `password` - the proxy password
      See Also:
        `clearProxySettings()`

    - #### clearProxySettings

          void clearProxySettings()

      Clears proxy server values.

    - #### getHostname

          java.lang.String getHostname()

      Gets hostname of server.
      Returns:
        hostname

    - #### setHostname

          FileTransfer setHostname(java.lang.String value)

      Sets hostname of server.
      Parameters:
        `value` - the hostname or IP address of server

    - #### getPort

          int getPort()

      Gets server port. Default value is 21.
      Returns:
        server port

    - #### setPort

          FileTransfer setPort(int value)

      Sets port of remote server.
      Parameters:
        `value` - the port

    - #### getTimeout

          long getTimeout()

      Gets the timeout for opening connection to server.
      Returns:
        timeout in milliseconds

    - #### setTimeout

          FileTransfer setTimeout(long value)

      Sets the timeout for opening connection to server.
      Parameters:
        `value` - the timeout in milliseconds

    - #### getUsername

          java.lang.String getUsername()

      Gets username.
      Returns:
        username

    - #### setUsername

          FileTransfer setUsername(java.lang.String value)

      Sets username.
      Parameters:
        `value` - the username

    - #### getPassword

          java.lang.String getPassword()

      Gets password.
      Returns:
        the password

    - #### setPassword

          FileTransfer setPassword(java.lang.String value)

      Sets password.
      Parameters:
        `value` - the password

    - #### getBlockTransferSize

          int getBlockTransferSize()

      Gets blocksize for use in transferring files.
      Returns:
        blocksize in bytes

    - #### setBlockTransferSize

          FileTransfer setBlockTransferSize(int value)

      Sets block size for use in transferring files.
      Parameters:
        `value` - the blocksize in bytes

    - #### getPassive

          boolean getPassive()

      Gets whether passive mode is used for FTP connections.
      Returns:
        `true` if passive mode is used, `false` otherwise

    - #### setPassive

          FileTransfer setPassive(boolean value)

      Sets whether passive mode is used for FTP connections.
      Parameters:
        `value` - if true, the transfers will be passive.

    - #### getMode

          int getMode()

      Gets data transfer mode for current session. Default mode is FileTransfer.AUTO where 0 = AUTO, 1 = ASCII, 2 = BINARY
      Returns:
        the data transfer mode
      See Also:
        `AUTO`, `BINARY`, `ASCII`

    - #### setAscii

          FileTransfer setAscii()

      Sets data transfer mode to ASCII. You must be connected to the server prior to invoking this method.
      Throws:
        `FileTransferException` - if an I/O or server error occurs.

    - #### setAuto

          FileTransfer setAuto(boolean value)

      Sets data transfer mode to automatically detect transfer mode. Any files with a base Content-Type value of text will be transferred using ASCII, all other files will be transfered using binary.

      Example: file.txt, Content-Type = text/plain, uploaded using ASCII
      Example: image.jpg Content-Type = image/jpg, uploaded using binary
      Parameters:
        `value` - `true` to turn automatic detect on `false` to turn off
      Throws:
        `FileTransferException` - if an I/O or server error occurs.

    - #### setBinary

          FileTransfer setBinary()

      Sets data transfer mode to binary. You must be connected to the server prior to invoking this method.
      Throws:
        `FileTransferException` - if an I/O or server error occurs.

    - #### getWireEncoding

          java.lang.String getWireEncoding()

      Gets encoding set used when issuing commands and transferring files.
      Returns:
        Returns the encoding is being used

    - #### setWireEncoding

          FileTransfer setWireEncoding(java.lang.String value)

      Sets encoding set used when issuing commands and transferring files. The default encoding is UTF8
      Parameters:
        `value` - the character encoding to be used

    - #### setPreserveFileUploadTimestamp

          FileTransfer setPreserveFileUploadTimestamp(boolean value)

      Get preserve file upload timestamps.
      Parameters:
        `value` -

    - #### setPreserveFileDownloadTimestamp

          FileTransfer setPreserveFileDownloadTimestamp(boolean value)

      Set preserve file download timestamps.
      Parameters:
        `value` -

    - #### isChecksumVerificationRequired

          boolean isChecksumVerificationRequired()

    - #### setChecksumVerificationRequired

          FileTransfer setChecksumVerificationRequired(boolean value)

    - #### setTimeZone

          FileTransfer setTimeZone(java.util.TimeZone value)

      Set the timezone, used for preserving timestamps.
      Parameters:
        `value` -

    - #### getDebug

          boolean getDebug()

      Gets debugging state.
      Returns:
        `true` if debugging is on

    - #### setDebug

          FileTransfer setDebug(boolean debug)

      Sets debugging state. All debug statements are reported to debug stream. Default debug stream is `System.out`.
      Parameters:
        `debug` - `true` to turn debugging on
      See Also:
        `setDebugStream(java.io.PrintStream)`

    - #### getDebugStream

          java.io.PrintStream getDebugStream()

      Gets PrintStream used in reporting debug statements. Default `PrintStream` is `System.out`.
      Returns:
        the `PrintStream` used in reporting debug statements
      See Also:
        `PrintStream`

    - #### setDebugStream

          FileTransfer setDebugStream(java.io.PrintStream ps)

      Sets `PrintStream` used in reporting debug statements. Default debug stream is `System.out`.
      Parameters:
        `ps` - the `PrintStream` to send debug statements to
      See Also:
        `PrintStream`

    - #### addFileTransferListener

          void addFileTransferListener(FileTransferListener listener)

      Adds FileTransferListener.
      Parameters:
        `listener` - the listener to add
      See Also:
        `FileTransferListener`

    - #### removeFileTransferListener

          void removeFileTransferListener(FileTransferListener listener)

      Removes specified FileTransferListener.
      Parameters:
        `listener` - the listener to remove
      See Also:
        `FileTransferListener`

    - #### getLocalDir

          java.io.File getLocalDir()

      Gets local directory to be used in session. Downloads will be stored relative to local directory. Uploads are performed relative to current local directory.
      Returns:
        the local directory

    - #### setLocalDir

          FileTransfer setLocalDir(java.io.File value)

      Sets local directory to be used in session. Downloads will be stored relative to local directory. Uploads are performed relative to current local directory.
      Parameters:
        `value` - the local directory

    - #### getLocalDirListing

          java.util.Enumeration getLocalDirListing()

      Gets local directory listing.
      Returns:
        an `java.util.Enumeration` of `File`

    - #### makeLocalDir

          java.io.File makeLocalDir(java.lang.String localDirectory)
                             throws FileTransferException

      Creates local directory. Directory is relative to current local directory
      Parameters:
        `localDirectory` - name of directory
      Returns:
        the directory
      Throws:
        `FileTransferException`
      See Also:
        `getLocalDir()`

    - #### getImplementation

          java.lang.Object getImplementation()

      Gets underlying file transfer instance.
      Returns:
        an instance of `Ftp`, `Ftps` or `Sftp`
      See Also:
        `Ftp`, `Ftps`

    - #### copy

          FileTransfer copy()

      Returns a copy of current transfer instance with same listeners.
      Returns:
        a copy of current transfer instance

    - #### connect

          FileTransfer connect()
                        throws FileTransferException

      Connects to server and performs login.
      Throws:
        `FileTransferException` - if an I/O or server error occurs.
      See Also:
        `setUsername(java.lang.String)`, `setPassword(java.lang.String)`

    - #### disconnect

          void disconnect()
                   throws FileTransferException

      Quits session and disconnects from server.
      Throws:
        `FileTransferException` - if an I/O or server error occurs.

    - #### close

          void close()

      Specified by:
        `close` in interface `java.lang.AutoCloseable`

    - #### isConnected

          boolean isConnected()

      Checks if client is connected to server.
      Returns:
        `true` if connected `false` otherwise

    - #### getDir

          java.lang.String getDir()
                           throws FileTransferException

      Gets current working directory of server.
      Returns:
        current directory
      Throws:
        `FileTransferException` - if an I/O or server error occurs.

    - #### setDir

          FileTransfer setDir(java.lang.String remoteDirectory)
                       throws FileTransferException

      Sets current directory on server.
      Parameters:
        `remoteDirectory` - the remote directory
      Throws:
        `FileTransferException` - if an I/O or server error occurs.

    - #### setDirUp

          FileTransfer setDirUp()
                         throws FileTransferException

      Sets current directory on server to parent directory.
      Throws:
        `FileTransferException` - if an I/O or server error occurs.

    - #### getDirListing

          java.util.Enumeration<FileTransferRemoteFile> getDirListing(java.lang.String regex)
                                                               throws FileTransferException

      Gets file listing of files matching regular expression. For example the regular expression "`.``*``\\.txt`" may return all files containing a .txt filename extension.
      Parameters:
        `regex` - the filename filter
      Returns:
        an `Enumeration` of `FileTransferRemoteFile` objects
      Throws:
        `FileTransferException` - if an I/O or server error occurs.
      See Also:
        `getDirListingAsString(String)`, `getNameListing(java.lang.String)`

    - #### getDirListing

          java.util.Enumeration<FileTransferRemoteFile> getDirListing()
                                                               throws FileTransferException

      Gets directory listing from server.
      Returns:
        an `Enumeration` of `FileTransferRemoteFile` objects
      Throws:
        `FileTransferException` - if an I/O or server error occurs.
      See Also:
        `getDirListingAsString(String)`, `getNameListing(java.lang.String)`

    - #### getDirListingAsString

          java.lang.String getDirListingAsString(java.lang.String regex)
                                          throws FileTransferException

      Gets file listing of files matching regular expression. For example the regular expression "`.``*``\\.txt`" may return all files containing a .txt filename extension.
      Parameters:
        `regex` - a filename filter
      Returns:
        a directory listing
      Throws:
        `FileTransferException` - if an I/O or server error occurs.

    - #### getDirListingAsString

          java.lang.String getDirListingAsString()
                                          throws FileTransferException

      Gets directory listing of files on server.
      Returns:
        a directory listing
      Throws:
        `FileTransferException` - if an I/O or server error occurs.

    - #### getNameListing

          java.util.Enumeration getNameListing(java.lang.String regex)
                                        throws FileTransferException

      Gets directory listing of files on server matching regular expression. For example "`.``*``\\.txt`" may return all files containing a .txt filename extension.
      Parameters:
        `regex` - 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

    - #### getNameListing

          java.util.Enumeration getNameListing()
                                        throws FileTransferException

      Gets directory listing of files on server.
      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

    - #### getRemoteFileList

          java.util.Vector<FileTransferRemoteFile> getRemoteFileList(java.lang.String remoteDirectory)
                                                              throws FileTransferException

      Get remote directory list.
      Parameters:
        `remoteDirectory` -
      Returns:
      Throws:
        `FileTransferException`

    - #### getRecursiveDirectorySize

          long getRecursiveDirectorySize(java.lang.String remoteDirectory)
                                  throws FileTransferException

      Get recursive directory size.
      Parameters:
        `remoteDirectory` -
      Returns:
      Throws:
        `FileTransferException`

    - #### getRecursiveDirectoryFileCount

          int getRecursiveDirectoryFileCount(java.lang.String remoteDirectory)
                                      throws FileTransferException

      Get recursive directory file count.
      Parameters:
        `remoteDirectory` -
      Returns:
      Throws:
        `FileTransferException`

    - #### makeDir

          void makeDir(java.lang.String remoteDirectory)
                throws FileTransferException

      Makes directory on server.
      Parameters:
        `remoteDirectory` - name of directory to make
      Throws:
        `FileTransferException` - if an I/O or server error occurs.

    - #### makeDirRecursive

          void makeDirRecursive(java.lang.String remoteDirectory)
                         throws FileTransferException

      Makes directory on server, creating subdirectories if necessary.
      Parameters:
        `remoteDirectory` - full path of directory to make
      Throws:
        `FileTransferException` - if an I/O or server error occurs

    - #### deleteDir

          void deleteDir(java.lang.String remoteDirectory)
                  throws FileTransferException

      Deletes directory from server.
      Parameters:
        `remoteDirectory` - the directory to remove
      Throws:
        `FileTransferException` - if an I/O or server error occurs.

    - #### deleteDir

          void deleteDir(java.lang.String remoteDirectory,
                         boolean recursive)
                  throws FileTransferException

      Deletes directory from server. If the directory cannot be deleted because it is not empty the `recursive` parameter will be used to determine if files and subdirectories within directory should be removed.
      Parameters:
        `remoteDirectory` - 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.

    - #### exists

          boolean exists(java.lang.String remotePath)
                  throws FileTransferException

      Checks if the specified path exists on the remote server.
      Parameters:
        `remotePath` - a path to verify
      Returns:
        `true` if path exists; `false` otherwise
      Throws:
        `FileTransferException` - if an error occurs

    - #### isDirectory

          boolean isDirectory(java.lang.String remotePath)
                       throws FileTransferException

      Throws:
        `FileTransferException`

    - #### getFilesize

          long getFilesize(java.lang.String remoteFile)
                    throws FileTransferException

      Gets filesize of remote file from server.

      When using the FTP/S protocols the SIZE command is used. The SIZE command is not part of RFC-959 so may not work on all FTP servers.
      Parameters:
        `remoteFile` - the remote file
      Returns:
        filesize in bytes
      Throws:
        `FileTransferException` - if an I/O or protocol error occurs.

    - #### getFileTimestamp

          java.util.Date getFileTimestamp(java.lang.String remoteFile)
                                   throws FileTransferException

      Gets date/timestamp of remote file from server.

      When using the FTP/S protocols the MDTM command is used. The MDTM command is not part of RFC-959 so may not work on all FTP servers.
      Parameters:
        `remoteFile` - the remote file
      Returns:
        date the date/timestamp of remote file
      Throws:
        `FileTransferException` - if an I/O or server error occurs.

    - #### setFileTimestamp

          FileTransfer setFileTimestamp(java.lang.String remoteFile,
                                        java.util.Date timestamp)
                                 throws FileTransferException

      Sets date/timestamp of remote file from server

      When using the FTP/S protocols the MDTM command is used. The MDTM command is not part of RFC-959 so may not work on all FTP servers.
      Parameters:
        `remoteFile` - the remote file
        `timestamp` - the new date/timestamp
      Throws:
        `FileTransferException` - if an I/O or server error occurs.

    - #### setFileModificationTime

          FileTransfer setFileModificationTime(java.lang.String remoteFile,
                                               java.util.Date modificationTime)
                                        throws FileTransferException

      Set file modifcation time.
      Parameters:
        `remoteFile` - - the remote file.
        `modificationTime` - - the time.
      Throws:
        `FileTransferException`

    - #### sameChecksum

          boolean sameChecksum(java.io.File localFile,
                               java.lang.String remoteFile)
                        throws FileTransferException

      Checks a checksum equality of local and remote files.
      Parameters:
        `localFile` - a local file
        `remoteFile` - a remote file
      Returns:
        `true` if checksums are equal; `false` otherwise
      Throws:
        `FileTransferException` - if an error occurs

    - #### renameFile

          void renameFile(java.lang.String sourceRemoteFile,
                          java.lang.String destinationRemoteFile)
                   throws FileTransferException

      Renames remote file on server.
      Parameters:
        `sourceRemoteFile` - name of file to rename
        `destinationRemoteFile` - new name of file
      Throws:
        `FileTransferException` - if an I/O or server error occurs.

    - #### deleteFile

          void deleteFile(java.lang.String remoteFile)
                   throws FileTransferException

      Deletes remote file from server.
      Parameters:
        `remoteFile` - name of file to delete
      Throws:
        `FileTransferException` - if an I/O or server error occurs.

    - #### mdelete

          void mdelete(java.lang.String regex)
                throws FileTransferException

      Deletes multiple files in servers current directory matching regular expression. For example, to delete all files ending with .txt extension you may use the regular expression "`.``*``\\.txt`".
      Parameters:
        `regex` - the regular expression filter to use
      Throws:
        `FileTransferException` - if an error occurs.

    - #### download

          void download(java.io.OutputStream out,
                        java.lang.String remoteFile)
                 throws FileTransferException

      Downloads file from server and writes contents to provided `OutputStream`. Closure of `OutputStream` is responsibility of programmer.
      Parameters:
        `out` - the OutputStream to write download to
        `remoteFile` - remote filename
      Throws:
        `FileTransferException` - if an I/O or server error occurs.

    - #### download

          java.io.File download(java.lang.String localFile,
                                java.lang.String remoteFile)
                         throws FileTransferException

      Downloads file from server. Downloads are stored relative to current local directory.
      Parameters:
        `localFile` - destination filename
        `remoteFile` - remote filename
      Returns:
        File the file downloaded
      Throws:
        `FileTransferException` - if an I/O or server error occurs.
      See Also:
        `setLocalDir(java.io.File)`

    - #### download

          java.io.File download(java.lang.String remoteFile)
                         throws FileTransferException

      Downloads file from server. Downloads are stored relative to current local directory.
      Parameters:
        `remoteFile` - the file to download
      Returns:
        File the file downloaded
      Throws:
        `FileTransferException` - if an I/O or server error occurs.
      See Also:
        `setLocalDir(java.io.File)`

    - #### resumeDownload

          void resumeDownload(java.io.OutputStream out,
                              java.lang.String remoteFile,
                              long remoteFileOffset)
                       throws FileTransferException

      Throws:
        `FileTransferException`

    - #### resumeDownload

          void resumeDownload(java.lang.String localFile,
                              java.lang.String remoteFile,
                              long remoteFileOffset)
                       throws FileTransferException

      Resumes download of file from server.
      Parameters:
        `localFile` - local file name
        `remoteFile` - the file to download
        `remoteFileOffset` - file offset in bytes
      Throws:
        `FileTransferException` - if an I/O or server error occurs.

    - #### resumeDownload

          void resumeDownload(java.lang.String remoteFile,
                              long remoteFileOffset)
                       throws FileTransferException

      Resumes download of file from server.
      Parameters:
        `remoteFile` - the file to download
        `remoteFileOffset` - file offset in bytes
      Throws:
        `FileTransferException` - if an I/O or server error occurs.

    - #### mdownload

          void mdownload(java.util.Enumeration remoteFiles)
                  throws FileTransferException

      Downloads specified files in current working remote directory from server to local directory. Do not use this method to download a directory, see `downloadDir(String)` method.

      Downloads are stored relative to current local directory.
      Parameters:
        `remoteFiles` - filenames of files to download
      Throws:
        `FileTransferException` - if an I/O or server error occurs.
      See Also:
        `setLocalDir(java.io.File)`, `downloadDir(String)`

    - #### mdownload

          void mdownload(java.lang.String regex)
                  throws FileTransferException

      Downloads multiple files matching regular expression from server's current directory. Downloads are stored relative to current local directory. For example, to download all files ending with extension .txt use the filter "`.``*``\\.txt`".

      To download a directory use the `downloadDir` method.
      Parameters:
        `regex` - the regular expression to use
      Throws:
        `FileTransferException` - if an I/O or server error occurs.
      See Also:
        `setLocalDir(java.io.File)`, `downloadDir(java.lang.String, int, boolean, int)`

    - #### downloadDir

          void downloadDir(java.lang.String remoteDirectory,
                           int retryAttempts,
                           boolean checksumVerificationRequired,
                           int threadCount)
                    throws FileTransferException

      Downloads remote directory and contents. Downloads are stored relative to current local directory.
      Parameters:
        `remoteDirectory` - the directory to download
        `retryAttempts` - retry limit if download fails
        `checksumVerificationRequired` - 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.

    - #### downloadDir

          void downloadDir(java.lang.String remoteDirectory,
                           int retryAttempts,
                           boolean checksumVerificationRequired)
                    throws FileTransferException

      Downloads remote directory and contents. Downloads are stored relative to current local directory.
      Parameters:
        `remoteDirectory` - the directory to download
        `retryAttempts` - retry limit if download fails
        `checksumVerificationRequired` - whether or not to perform checksum after download, only supported in FTP/S protocols and not by all FTP servers
      Throws:
        `FileTransferException` - if an I/O or protocol error occurs.

    - #### downloadDir

          void downloadDir(java.lang.String remoteDirectory)
                    throws FileTransferException

      Downloads remote directory and contents recursively from server. Downloads are stored relative to current local directory.
      Parameters:
        `remoteDirectory` - the directory to download
      Throws:
        `FileTransferException` - if an I/O or server error occurs.
      See Also:
        `setLocalDir(java.io.File)`

    - #### upload

          void upload(java.io.InputStream in,
                      long length,
                      java.lang.String remoteFile,
                      boolean shouldAppend)
               throws FileTransferException

      Throws:
        `FileTransferException`

    - #### upload

          void upload(byte[] data,
                      java.lang.String remoteFile,
                      boolean shouldAppend)
               throws FileTransferException

      Uploads file to server where contents of file is not on disk but in memory.
      Parameters:
        `data` - the raw contents of the file to upload
        `remoteFile` - the filename to store file as on server
        `shouldAppend` - `true` to append to remote file on FTP server, `false` otherwise
      Throws:
        `FileTransferException` - if an I/O or server related error occurs

    - #### upload

          void upload(byte[] data,
                      java.lang.String remoteFile)
               throws FileTransferException

      Uploads file to server where contents of file is not on disk but in memory.
      Parameters:
        `data` - the raw contents of the file to upload
        `remoteFile` - the filename to store file as on FTP server
      Throws:
        `FileTransferException` - if an I/O or server related error occurs

    - #### upload

          void upload(java.io.File localFile,
                      java.lang.String remoteFile,
                      boolean shouldAppend)
               throws FileTransferException

      Uploads file to server. If `file` is a directory then directory and entire contents are uploaded.
      Parameters:
        `localFile` - the local file to upload
        `remoteFile` - the destination filename of upload
        `shouldAppend` - `true` to append to remote file on server, `false` otherwise
      Throws:
        `FileTransferException` - if an I/O or server related error occurs

    - #### upload

          void upload(java.io.File localFile,
                      java.lang.String remoteFile)
               throws FileTransferException

      Uploads file to server. If `file` is a directory then directory and entire contents are uploaded.
      Parameters:
        `localFile` - the local file to upload
        `remoteFile` - the destination filename of upload
      Throws:
        `FileTransferException` - if an I/O or server related error occurs

    - #### upload

          void upload(java.io.File localFile,
                      boolean shouldAppend)
               throws FileTransferException

      Uploads file to server. If `file` is a directory then directory and entire contents are uploaded.
      Parameters:
        `localFile` - the local file to upload
        `shouldAppend` - `true` to append to remote file on server, `false` otherwise
      Throws:
        `FileTransferException` - if an I/O or server related error occurs

    - #### upload

          void upload(java.lang.String tempFileExtension,
                      java.io.File localFile)
               throws FileTransferException

      Uploads file to server with the specified temporary extension. After the file has been uploaded then the file is renamed to the original filename.
      Parameters:
        `tempFileExtension` - the temporary extension to use when uploading the file
        `localFile` - the file to be uploaded
      Throws:
        `FileTransferException` - if an I/O or protocol error occurs

    - #### upload

          void upload(java.io.File localFile)
               throws FileTransferException

      Uploads file to server. If `file` is a directory then directory and entire contents are uploaded.
      Parameters:
        `localFile` - the local file to upload
      Throws:
        `FileTransferException` - if an I/O or server related error occurs

    - #### upload

          void upload(java.lang.String localFile,
                      java.lang.String remoteFile,
                      boolean shouldAppend)
               throws FileTransferException

      Uploads file to server. Uploads are performed relative to current local directory.
      Parameters:
        `localFile` - the local file to upload
        `remoteFile` - the destination of upload
        `shouldAppend` - `true` to append to remote file on FTP server, `false` otherwise
      Throws:
        `FileTransferException` - if an I/O or server error occurs.
      See Also:
        `setLocalDir(java.io.File)`

    - #### upload

          void upload(java.lang.String localFile,
                      java.lang.String remoteFile)
               throws FileTransferException

      Uploads file to server. Uploads are performed relative to current local directory.
      Parameters:
        `localFile` - the local file to upload
        `remoteFile` - the destination of upload
      Throws:
        `FileTransferException` - if an I/O or server error occurs.
      See Also:
        `setLocalDir(java.io.File)`

    - #### upload

          void upload(java.lang.String localFile,
                      boolean shouldAppend)
               throws FileTransferException

      Uploads file to server. Uploads are performed relative to current local directory.
      Parameters:
        `localFile` - the local file to upload
        `shouldAppend` - `true` to append to remote file on server, `false` otherwise
      Throws:
        `FileTransferException` - if an I/O or server error occurs.
      See Also:
        `setLocalDir(java.io.File)`

    - #### upload

          void upload(java.lang.String localFile)
               throws FileTransferException

      Uploads file to server. Uploads are performed relative to current local directory.
      Parameters:
        `localFile` - the local file to upload
      Throws:
        `FileTransferException` - if an I/O or server error occurs.
      See Also:
        `setLocalDir(java.io.File)`

    - #### resumeUpload

          void resumeUpload(java.io.InputStream in,
                            long length,
                            java.lang.String remoteFile,
                            long remoteFileOffset)
                     throws FileTransferException

      Throws:
        `FileTransferException`

    - #### resumeUpload

          void resumeUpload(java.io.File localFile,
                            java.lang.String remoteFile,
                            long localFileOffset)
                     throws FileTransferException

      Resume upload of file to server.
      Parameters:
        `localFile` -
        `remoteFile` -
        `localFileOffset` -
      Throws:
        `FileTransferException`

    - #### resumeUpload

          void resumeUpload(java.io.File localFile,
                            long localFileOffset)
                     throws FileTransferException

      Resumes upload of file to server.
      Parameters:
        `localFile` - the local file to upload
        `localFileOffset` - file offset in bytes
      Throws:
        `FileTransferException` - if an I/O or server error occurs.

    - #### resumeUpload

          void resumeUpload(java.lang.String localFile,
                            long localFileOffset)
                     throws FileTransferException

      Resumes upload of file to server.
      Parameters:
        `localFile` - the local file to upload
        `localFileOffset` - file offset in bytes
      Throws:
        `FileTransferException` - if an I/O or server error occurs.

    - #### uploadUnique

          java.lang.String uploadUnique(java.io.InputStream in,
                                        java.lang.String remoteFilePrefix)
                                 throws FileTransferException

      Uploads the file which is created in the current directory under a name unique to that directory.
      Parameters:
        `in` - the `InputStream` to upload file from
        `remoteFilePrefix` - 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.

    - #### uploadUnique

          java.lang.String uploadUnique(java.io.File localFile)
                                 throws FileTransferException

      Uploads the file which is created in the current directory under a name unique to that directory.
      Parameters:
        `localFile` - the file to be uploaded
      Returns:
        the resulting unique filename on server
      Throws:
        `FileTransferException` - if an I/O or protocol error occurs.

    - #### uploadUnique

          java.lang.String uploadUnique(java.lang.String localFile)
                                 throws FileTransferException

      Uploads the file which is created in the current directory under a name unique to that directory.
      Parameters:
        `localFile` - 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:
        `setLocalDir(File)`

    - #### mupload

          void mupload(java.util.Enumeration localFiles)
                throws FileTransferException

      Uploads multiple files to server. Uploads are performed relative to current local directory.
      Parameters:
        `localFiles` - filenames of files to upload
      Throws:
        `FileTransferException` - if an I/O or server error occurs.
      See Also:
        `setLocalDir(java.io.File)`

    - #### mupload

          void mupload(java.lang.String regex)
                throws FileTransferException

      Uploads multiple files matching regular expression to server's current directory. Uploads are performed relative to current local directory. For example, to upload all files with extension .txt you may use the regular expression "`.``*``\\.txt`".
      Parameters:
        `regex` - the regular expression to use
      Throws:
        `FileTransferException` - if an I/O or server error occurs.
      See Also:
        `setLocalDir(java.io.File)`

    - #### uploadDir

          void uploadDir(java.io.File localDirectory,
                         int retryAttempts,
                         boolean checksumVerificationRequired,
                         java.lang.String tempFileExtension,
                         int threadCount)
                  throws FileTransferException

      Uploads local directory and contents. Uploads are stored relative to current remote directory.
      Parameters:
        `localDirectory` - the directory to upload
        `retryAttempts` - retry number when an error occurs
        `checksumVerificationRequired` - whether or not to perform checksum verification
        `tempFileExtension` - the temporary extension which will be used when uploading files or `null` to use current extension
        `threadCount` -
      Throws:
        `FileTransferException` - if an I/O or protocol related error occurs.

    - #### uploadDir

          void uploadDir(java.io.File localDirectory,
                         int retryAttempts,
                         boolean checksumVerificationRequired,
                         java.lang.String tempFileExtension)
                  throws FileTransferException

      Uploads local directory and contents. Uploads are stored relative to current remote directory.
      Parameters:
        `localDirectory` - the directory to upload
        `retryAttempts` - retry number when an error occurs
        `checksumVerificationRequired` - whether or not to perform checksum verification
        `tempFileExtension` - 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.

    - #### uploadDir

          void uploadDir(java.io.File localDirectory,
                         java.lang.String tempFileExtension)
                  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.
      Parameters:
        `localDirectory` - the directory to upload
        `tempFileExtension` - The extension file name used to upload each file
      Throws:
        `FileTransferException` - if an I/O or protocol error occurs.

    - #### uploadDir

          void uploadDir(java.io.File localDirectory)
                  throws FileTransferException

      Uploads local directory and contents recursively to server. Uploads are stored relative to current remote directory.
      Parameters:
        `localDirectory` - the directory to upload
      Throws:
        `FileTransferException` - if an I/O or protocol error occurs.

    - #### getInputStream

          java.io.InputStream getInputStream(java.lang.String remoteFile,
                                             long remoteFileOffset)
                                      throws FileTransferException

      Gets `InputStream` for remote file for reading.
      Parameters:
        `remoteFile` - the remote file to get `InputStream` for
        `remoteFileOffset` - the byte offset, 0 to get full file
      Returns:
        an `InputStream`
      Throws:
        `FileTransferException` - if an I/O or protocol related error occurs

    - #### getOutputStream

          java.io.OutputStream getOutputStream(java.lang.String remoteFile,
                                               long remoteFileOffset)
                                        throws FileTransferException

      Gets `OutputStream` for writing to remote file.
      Parameters:
        `remoteFile` - the remote filename
        `remoteFileOffset` - the byte offset, 0 to write at beginning of file
      Returns:
        an `OutputStream`
      Throws:
        `FileTransferException` - if an I/O or protocol related error occurs

    - #### interrupt

          void interrupt()

      Interrupts the current data transfer and sets interrupted flag to `true`. After invoking this method you must reset the interrupted flag to `false`. before transferring any files.
      See Also:
        `reset()`

    - #### interrupted

          boolean interrupted()

      Checks if transfer process was interrupted.
      Returns:
        `true` if transfer process was interrupted.

    - #### reset

          void reset()

      Resets the interrupted flag to `false`. This method should be invoked if you have interrupted a transfer using the `interrupt` method and wish to resume transfering files.
      See Also:
        `interrupt()`

    - #### abortUploadThreads

          void abortUploadThreads()

      Abort all upload threads. Used by the implementing classes Sftp, Ftp, Ftps to abort all spawned threads.

    - #### abortUploadThread

          void abortUploadThread(java.lang.String remoteFile)

      Abort upload thread.
      Parameters:
        `remoteFile` -

    - #### abortDownloadThread

          void abortDownloadThread(java.lang.String remoteFile)

      Abort download thread.
      Parameters:
        `remoteFile` -

    - #### abortDownloadThreads

          void abortDownloadThreads()

      Abort all download threads. Used by the implementing classes Sftp, Ftp, Ftps to abort all spawned threads.

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