Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.mindbright.ssh2
Class SSH2SFTPTransfer

    java.lang.Object
      com.mindbright.ssh2.SSH2SFTPTransfer

All Implemented Interfaces:
  SSH2SFTP.AsyncListener, SSHFileTransfer

public class SSH2SFTPTransfer
extends java.lang.Object
implements SSHFileTransfer, SSH2SFTP.AsyncListener

Convenience class for transferring files to and from the server.

Constructor Summary
`SSH2SFTPTransfer(java.io.File cwd, SSH2Connection connection)`

Method Summary
`void` | `abort()` Abort all operations
`void` | `copyToLocal(java.lang.String localFile, java.lang.String[] remoteFiles, boolean recursive)` Copy remote files to the local system.
`void` | `copyToRemote(java.lang.String[] localFiles, java.lang.String remoteFile, boolean recursive)` Copy local files to the server.
`void` | `progress(long size)` Gets called periodically during the file transfer.
`void` | `setProgress(SSHFileTransferProgress progress)` Associate a `SSHFileTransferProgress` object with this file transfer object.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### SSH2SFTPTransfer

    public SSH2SFTPTransfer(java.io.File cwd,
                            SSH2Connection connection)
                     throws SSH2Exception

Parameters:
  `cwd` - Directory on server to transfer the files to/from.
  `connection` - SSH connection to use.

Method Detail

### setProgress

    public void setProgress(SSHFileTransferProgress progress)

  Description copied from interface: `SSHFileTransfer`
  Associate a `SSHFileTransferProgress` object with this file transfer object. The associated object will get reports on any transfer progress.

  Specified by:
    `setProgress` in interface `SSHFileTransfer`
  Parameters:
    `progress` - Object which will get progress reports.

### copyToRemote

    public void copyToRemote(java.lang.String[] localFiles,
                             java.lang.String remoteFile,
                             boolean recursive)
                      throws java.io.IOException

  Description copied from interface: `SSHFileTransfer`
  Copy local files to the server. If the `remoteFile` parameter refers to a directory the all local files are placed into it. However it is kind of meaningless to specify multiple local files and one remote regular file since all files will be copied to the same name.

  Specified by:
    `copyToRemote` in interface `SSHFileTransfer`
  Parameters:
    `localFiles` - Array of local files to copy.
    `remoteFile` - Name to store file(s) as on server. If this is a directory then all files are copied to that directory.
    `recursive` - If true recurse into directories and copy all files found. The directory structure is recreated on the server.
  Throws:
    `java.io.IOException`

### copyToLocal

    public void copyToLocal(java.lang.String localFile,
                            java.lang.String[] remoteFiles,
                            boolean recursive)
                     throws java.io.IOException

  Description copied from interface: `SSHFileTransfer`
  Copy remote files to the local system. If the `localFile` parameter refers to a directory the all remote files are placed into it. However it is kind of meaningless to specify multiple remote files and one local regular file since all files will be copied to the same name.

  Specified by:
    `copyToLocal` in interface `SSHFileTransfer`
  Parameters:
    `localFile` - Name to store file(s) as locally. If this is a directory then all files are copied to that directory.
    `remoteFiles` - Array of files to copy.
    `recursive` - If true recurse into directories and copy all files found. The directory structure is recreated on the server.
  Throws:
    `java.io.IOException`

### abort

    public void abort()

  Description copied from interface: `SSHFileTransfer`
  Abort all operations

  Specified by:
    `abort` in interface `SSHFileTransfer`

### progress

    public void progress(long size)

  Description copied from interface: `SSH2SFTP.AsyncListener`
  Gets called periodically during the file transfer.

  Specified by:
    `progress` in interface `SSH2SFTP.AsyncListener`
  Parameters:
    `size` - How many bytes have been transferred so far

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD