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.SSH2Exception
public void setProgress(SSHFileTransferProgress progress)
SSHFileTransfer
SSHFileTransferProgress
object with
this file transfer object. The associated object will get
reports on any transfer progress.setProgress
in interface SSHFileTransfer
progress
- Object which will get progress reports.public void copyToRemote(java.lang.String[] localFiles, java.lang.String remoteFile, boolean recursive) throws java.io.IOException
SSHFileTransfer
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.copyToRemote
in interface SSHFileTransfer
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.java.io.IOException
public void copyToLocal(java.lang.String localFile, java.lang.String[] remoteFiles, boolean recursive) throws java.io.IOException
SSHFileTransfer
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.copyToLocal
in interface SSHFileTransfer
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.java.io.IOException
public long[] getFileSizeCount(java.lang.String[] filelist) throws java.io.IOException
getFileSizeCount
in interface SSHFileTransfer
java.io.IOException
public void abort()
SSHFileTransfer
abort
in interface SSHFileTransfer
public void progress(long size)
SSH2SFTP.AsyncListener
progress
in interface SSH2SFTP.AsyncListener
size
- How many bytes have been transferred since the
last call to this function.