...
public FileAttributes resume(String remote, String local,
FileTransferProgress progress)
throws IOException, TransferCancelledException {
String remotePath = resolveRemotePath(remote);
FileAttributes attrs = stat(remotePath);
if (progress != null) {
progress.started(attrs.getSize().longValue(), remotePath);
}
long resumeOffset = 0;
File localFile = new File(local);
RandomAccessFile randomAccessFile = new RandomAccessFile(localFile, "rw");
if(localFile.exists()) {
resumeOffset = (int)randomAccessFile.length();
randomAccessFile.seek(resumeOffset);
}
SftpFileInputStream in = new SftpFileInputStream(sftp.openFile(
remotePath, SftpSubsystemClient.OPEN_READ), resumeOffset);
transferFile(in, randomAccessFile, progress);
if (progress != null) {
progress.completed();
}
return attrs;
}
...