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.sshcommon
Class SSHSCP1

    java.lang.Object
      com.mindbright.sshcommon.SSHSCP1

All Implemented Interfaces:
  SSHFileTransfer

public final class SSHSCP1
extends java.lang.Object
implements SSHFileTransfer

Copy files using the scp1 protocol. The scp1 protocol is not officially documented but it is very similar to the rcp protocol. The protocol was first introduce together with version 1 of ssh. Hence the '1' in the name which is very confusing because nothing prevents this protocol to run on top of SSHv2. In fact the protocol is completely transport neutral and instead relies on the presence of a compatible scp command on the server.

Field Summary
`static int` | `DEFAULT_COPY_BUFFER_SZ` SIze of chunks used when copying files

Constructor Summary
`SSHSCP1(java.io.File cwd, SSHConsoleRemote remote, boolean verbose)` Create a new instance ready to copy files and which uses the provided SSHConsoleRemote instance.

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` | `copyToLocal(java.lang.String localFile, java.lang.String remoteFile, boolean recursive)` Copy a single remote file or directory to the local system
`void` | `copyToRemote(java.lang.String[] localFiles, java.lang.String remoteFile, boolean recursive)` Copy local files to the server.
`void` | `copyToRemote(java.lang.String localFile, java.lang.String remoteFile, boolean recursive)` Copy a single local file or directory to the remote server
`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`

Field Detail

### DEFAULT_COPY_BUFFER_SZ

    public static final int DEFAULT_COPY_BUFFER_SZ

  SIze of chunks used when copying files

  See Also:
    Constant Field Values

Constructor Detail

### SSHSCP1

    public SSHSCP1(java.io.File cwd,
                   SSHConsoleRemote remote,
                   boolean verbose)

  Create a new instance ready to copy files and which uses the provided SSHConsoleRemote instance.

Parameters:
  `cwd` - local directory names are specified relatively to.
  `remote` - the remote ssh console instance to transfer files over
  `verbose` - if true the verbose progress is reported

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.

### abort

    public void abort()

  Description copied from interface: `SSHFileTransfer`
  Abort all operations

  Specified by:
    `abort` in interface `SSHFileTransfer`

### copyToRemote

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

  Copy a single local file or directory to the remote server

  Parameters:
    `localFile` - local file to copy
    `remoteFile` - remote name
    `recursive` - if true and the local file is a directory then the entire content of that directory is copied as well.
  Throws:
    `java.io.IOException`

### 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`

### copyToLocal

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

  Copy a single remote file or directory to the local system

  Parameters:
    `localFile` - destination file name
    `remoteFile` - remote file or directory to copy
    `recursive` - if true and the remote file is a directory then the entire content of that directory is copied as well.
  Throws:
    `java.io.IOException`

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