Package org.eclipse.ecf.filetransfer

Examples of org.eclipse.ecf.filetransfer.UserCancelledException


      exception = newUserCancelledException();
    }
  }

  protected UserCancelledException newUserCancelledException() {
    return new UserCancelledException(Messages.AbstractRetrieveFileTransfer_Exception_User_Cancelled);
  }
View Full Code Here


  // TODO: replace other instances.
  /**
   * @since 3.0
   */
  protected UserCancelledException newUserCancelledException() {
    return new UserCancelledException(Messages.AbstractRetrieveFileTransfer_Exception_User_Cancelled);
  }
View Full Code Here

      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()) {
View Full Code Here

  }

  public void cancel() {
    try {
      torrent.stop();
      notifyCompletion(new UserCancelledException());
    } catch (final IOException e) {
      notifyCompletion(e);
    }
  }
View Full Code Here

          + Messages.XMPPIncomingFileTransfer_Progress_Data,
          totalWork);
      try {
        while (!isDone()) {
          if (monitor.isCanceled())
            throw new UserCancelledException(
                Messages.XMPPIncomingFileTransfer_Exception_User_Cancelled);
          final int bytes = remoteFileContents.read(buf);
          if (bytes != -1) {
            bytesReceived += bytes;
            localFileContents.write(buf, 0, bytes);
View Full Code Here

              negotiation = false;
            }
          }

          if (localCancelled) {
            setErrorStatus(new UserCancelledException(
                "Transfer cancelled by sender")); //$NON-NLS-1$
            return;
          }

          outgoingFileTransfer.sendStream(new FileInputStream(
View Full Code Here

TOP

Related Classes of org.eclipse.ecf.filetransfer.UserCancelledException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.