com.mindbright.sshcommon
public final class SSHSCP1 extends java.lang.Object implements SSHFileTransfer
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_COPY_BUFFER_SZ
SIze of chunks used when copying files
|
| Constructor and Description |
|---|
SSHSCP1(java.io.File cwd,
SSHConsoleRemote remote,
boolean verbose)
Create a new instance ready to copy files and which uses the
provided SSHConsoleRemote instance.
|
| Modifier and Type | Method and Description |
|---|---|
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
|
long[] |
getFileSizeCount(java.lang.String[] remoteFiles) |
void |
setProgress(SSHFileTransferProgress progress)
Associate a
SSHFileTransferProgress object with
this file transfer object. |
public static final int DEFAULT_COPY_BUFFER_SZ
public SSHSCP1(java.io.File cwd,
SSHConsoleRemote remote,
boolean verbose)
cwd - local directory names are specified relatively to.remote - the remote ssh console instance to transfer files
oververbose - if true the verbose progress is reportedpublic void setProgress(SSHFileTransferProgress progress)
SSHFileTransferSSHFileTransferProgress object with
this file transfer object. The associated object will get
reports on any transfer progress.setProgress in interface SSHFileTransferprogress - Object which will get progress reports.public void abort()
SSHFileTransferabort in interface SSHFileTransferpublic void copyToRemote(java.lang.String localFile,
java.lang.String remoteFile,
boolean recursive)
throws java.io.IOException
localFile - local file to copyremoteFile - remote namerecursive - if true and the local file is a directory then
the entire content of that directory is copied as well.java.io.IOExceptionpublic void copyToRemote(java.lang.String[] localFiles,
java.lang.String remoteFile,
boolean recursive)
throws java.io.IOException
SSHFileTransferremoteFile
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.copyToRemote in interface SSHFileTransferlocalFiles - 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.java.io.IOExceptionpublic void copyToLocal(java.lang.String localFile,
java.lang.String[] remoteFiles,
boolean recursive)
throws java.io.IOException
SSHFileTransferlocalFile
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.copyToLocal in interface SSHFileTransferlocalFile - 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.java.io.IOExceptionpublic void copyToLocal(java.lang.String localFile,
java.lang.String remoteFile,
boolean recursive)
throws java.io.IOException
localFile - destination file nameremoteFile - remote file or directory to copyrecursive - if true and the remote file is a directory then
the entire content of that directory is copied as well.java.io.IOExceptionpublic long[] getFileSizeCount(java.lang.String[] remoteFiles)
getFileSizeCount in interface SSHFileTransfer