Call this to cancel before finishing the data.
195043
public void cancel() {
        try {
            // FileOutputStream is also closed cascadingly
            if (outStream != null) {
                outStream.close();
                outStream = null;
            }
            // Clear encryptor:
            encryptor = null;
        } catch (IOException e) {
            Log.w(Log.TAG_BLOB_STORE, "Exception closing buffered output stream", e);
        }
        tempFile.delete();
    }
1242454
public synchronized void cancelAll() {
		if (activeRequests.size() > 0) {
			List<HttpRequest> temp = new ArrayList<>(activeRequests);
			for (HttpRequest request : temp) {
				request.cancel();
			}
		}
		notifyCancelledAllRequests();
	}
356052
function cancel() {
    timeouts.forEach(function (timeout) {
      clearTimeout(timeout);
    });
    Object.keys(callbacks).forEach(function (key) {
      callbacks[key]('cancel');
      delete callbacks[key];
    });
    timeouts = [];
  }
717669
public function cancel()
    {
        if (isset($this->pointer) && isset($this->router) && !$this->cancelled)
        {
            $this->router->removeHandler($this->pointer[0], $this->pointer[1]);
            $this->cancelled = true;
        }
    }
939592
@Weight(value = Weight.Unit.VARIABLE, comment = "Depends on the current call stack depth")
  public static void cancel() {
    final int stackDepth = ThreadUtils.stackDepth();

    final List<TimeData> list = REGISTRY.get();
    final Iterator<TimeData> iterator = list.iterator();

    while (iterator.hasNext()) {
      final TimeData timeWatchItem = iterator.next();
      if (timeWatchItem.getDetectedStackDepth() >= stackDepth) {
        iterator.remove();
      }
    }
    if (list.isEmpty()) {
      REGISTRY.remove();
    }
  }
500680
def cancelAllPendingResults( self ):
        """"""
        for k in self._results.keys():
            rs = self._results[k]
            self._results[k] = [ j for j in rs if isinstance(j, dict) ]
        self._pending = dict()
459179
public void cancel() {
      if (!isCancelled) {
         isCancelled = true;

         IntSet segmentsCopy = getUnfinishedSegments();
         synchronized (segments) {
            unfinishedSegments.clear();
         }
         if (trace) {
            log.tracef("Cancelling inbound state transfer from %s with unfinished segments %s", source, segmentsCopy);
         }

         sendCancelCommand(segmentsCopy);

         notifyCompletion(false);
      }
   }
1236693
public void requestCancellation() {
        Collection<CompletableFuture<?>> toInvoke;
        synchronized (this.futures) {
            this.cancellationRequested = true;
            toInvoke = new ArrayList<>(this.futures);
        }

        toInvoke.forEach(f -> f.cancel(true));
        synchronized (this.futures) {
            this.futures.clear();
        }
    }
841150
def cancel(self):
        """"""
        if self.OBSERVE_UPDATES:
            self.detach()
        self.ioloop.add_callback(self.cancel_timeouts)
1347176
def cancel(self):
        
        LOG.debug('cancelling %s', self)
        self._cancelled = True
        self.clear_callbacks()  # not strictly necessary, but may release references
        while True:
            try:
                self._waitables.get_nowait().put_nowait(self.sentinel)
            except queue.Empty:
                break
1041986
public function cancel()
    {
        if (!$this->has_real_call) {
            $this->has_real_call = true;
            $this->createRealCall();
        }
        $this->real_call->cancel();
    }
246228
def cancel(self, cancel_running=True, mark_completed_as_cancelled=False):
    

    with self._lock:
      for future in self._queue:
        future.cancel(mark_completed_as_cancelled)
      if cancel_running:
        for future in self._running:
          future.cancel(mark_completed_as_cancelled)
      self._queue.clear()
702714
public function cancel()
    {
        $data = $this->twisto->requestJson('POST', 'invoice/' . urlencode($this->invoice_id) . '/cancel/');
        $this->deserialize($data);
    }
385670
public void cancelReporting() {
        if (startupReportFuture != null) {
            startupReportFuture.cancel(true);
        }
        if (execService != null) {
            // interrupt reporting loop
            execService.shutdownNow();
        }
    }
1264420
def cancelPendingResultsFor( self, ps ):
        """"""
        k = self._parametersAsIndex(ps)

        if k in self._results.keys():
            # remove from results
            rs = self._results[k]
            js = [ j for j in rs if not isinstance(j, dict) ]
            self._results[k] = [ rc for rc in rs if isinstance(rc, dict) ]

            # ...and from pending jobs list
            for j in js:
                del self._pending[j]
1292262
def cancel(self):
        
        if self.done():
            return False

        self._client.cancel_operation(self._operation.name)
        return True
192757
def abort_request(self, request):
        """"""
        self.timedout = True
        try:
            request.cancel()
        except error.AlreadyCancelled:
            return