private boolean cancelled = false;
public IIncomingFileTransfer receive(File localFileToSave) throws IOException {
if (cancelled) {
throw new RuntimeException(new UserCancelledException());
}
Assert.isNotNull(localFileToSave, "localFileToSave cannot be null"); //$NON-NLS-1$
if (localFileToSave.exists() && !localFileToSave.canWrite()) {
throw new IOException("file="+localFileToSave.getAbsolutePath()+" does not exist or cannot be written to"); //$NON-NLS-1$ //$NON-NLS-2$
}
final TorrentFile file = new TorrentFile(((TorrentID) remoteFileReference).getFile());
file.setTargetFile(localFileToSave);
final Torrent torrent = TorrentFactory.createTorrent(file);
transfer = new TorrentFileTransfer(remoteFileReference, transferListener, torrent);
return transfer;
}
public IIncomingFileTransfer receive(File localFileToSave, FileTransferJob fileTransferJob) throws IOException {
if (cancelled) {
throw new RuntimeException(new UserCancelledException());
}
Assert.isNotNull(localFileToSave, "localFileToSave must not be null"); //$NON-NLS-1$
if (localFileToSave.exists() && !localFileToSave.canWrite()) {