com.mindbright.ssh2
public class SSH2SFTPTransfer extends java.lang.Object implements SSHFileTransfer, SSH2SFTP.AsyncListener
| Constructor and Description |
|---|
SSH2SFTPTransfer(java.io.File cwd,
SSH2Connection connection) |
| 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 |
copyToRemote(java.lang.String[] localFiles,
java.lang.String remoteFile,
boolean recursive)
Copy local files to the server.
|
long[] |
getFileSizeCount(java.lang.String[] filelist) |
void |
progress(long size)
Gets called periodically during the file transfer.
|
void |
setProgress(SSHFileTransferProgress progress)
Associate a
SSHFileTransferProgress object with
this file transfer object. |
public SSH2SFTPTransfer(java.io.File cwd,
SSH2Connection connection)
throws SSH2Exception
cwd - Directory on server to transfer the files to/from.connection - SSH connection to use.SSH2Exceptionpublic 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 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 long[] getFileSizeCount(java.lang.String[] filelist)
throws java.io.IOException
getFileSizeCount in interface SSHFileTransferjava.io.IOExceptionpublic void abort()
SSHFileTransferabort in interface SSHFileTransferpublic void progress(long size)
SSH2SFTP.AsyncListenerprogress in interface SSH2SFTP.AsyncListenersize - How many bytes have been transferred since the
last call to this function.