Stop the output stream, but further download will still perform
559708
def close(self):
        ""
        if self.stream:
            self.stream.close(self.scheduler)
            self.stream = None
1328073
void freeOutput() {
        state.pool.free( output );
        output = outputs.size() > 0 ? outputs.removeLast() : null;
    }
885753
public void stop() {
    if (inputThread != null) {
      if (inputStreamPumper != null) {
        inputStreamPumper.stopProcessing();
      }
      // #33 Interrupt reading from a PipedInputStream to unblock the pumping thread
      inputThread.interrupt();
      log.trace("Joining input thread {}...", inputThread);
      try {
        inputThread.join();
        inputThread = null;
      }
      catch (InterruptedException e) {
        // ignore
      }
    }

    if (outputThread != null) {
      log.trace("Joining output thread {}...", outputThread);
      try {
        outputThread.join();
        outputThread = null;
      }
      catch (InterruptedException e) {
        // ignore
      }
    }

    if (errorThread != null) {
      log.trace("Joining error thread {}...", errorThread);
      try {
        errorThread.join();
        errorThread = null;
      }
      catch (InterruptedException e) {
        // ignore
      }
    }

    flush();
  }
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();
    }
146141
def flush(self) -> None:
        
        self.underlying_stream.flush()
        self.file.flush()
        os.fsync(self.file.fileno())
381037
async def stop(self):
        
        if self.__started:
            self.__transport._unregister_rtp_receiver(self)
            self.__stop_decoder()
            self.__rtcp_task.cancel()
            await self.__rtcp_exited.wait()
403063
def stop(cls):
        
        main_log, cls.main_log = cls.main_log, StructuredLogger_usingStream(STDOUT)
        main_log.stop()
887939
def run(self):
        '''
        
        '''
        #Callback
        self._debug('Provider', 'run', 'Running pre-download callback.')
        self._pre_download()

        url = None
        out = None
        success = False

        try:
            url = Provider._download(self.get_download_url())

            #Callback
            self._debug('Provider', 'run', 'Running in-download callback.')
            self._in_download(url)

            #Invalid filename character fix
            if IS_WINDOWS:
                self.filename = re.sub(ur'[?\/\\<>:"*|]+', '_', self.filename, re.UNICODE)
            self.full_filename = '%s.%s' % (self.filename, self.fileext)
            self._debug('Provider', 'run', 'full_filename', self.full_filename)

            if not os.path.isfile(self.full_filename):
                #Save the stream to the output file
                out = open(self.full_filename, 'wb')
                out.write(url.read())
            else:
                #Skipping
                #TODO: warn
                pass

            #We are done therefore success!
            success = True
        finally:
            if out is not None:
                out.close()
            if url is not None:
                url.close()

            #Callback
            self._debug('Provider', 'run', 'Running post-download callback.')
            self._debug('Provider', 'run', 'success', success)
            self._post_download(success)
312522
def close(self) -> None:
        
        if self.underlying_stream:
            if self.using_stdout:
                sys.stdout = self.underlying_stream
            else:
                sys.stderr = self.underlying_stream
            self.underlying_stream = None
        if self.file:
            # Do NOT close the file; we don't own it.
            self.file = None
            log.debug("Finished copying {} to {}",
                      self.output_description, self.filename)
1360667
def end_output (self, **kwargs):
        """"""
        self.write_edges()
        self.end_graph()
        if self.has_part("outro"):
            self.write_outro()
        self.close_fileoutput()
1212906
def stop(self):
        """"""
        self._flush()
        filesize = self.file.tell()
        super(BLFWriter, self).stop()

        # Write header in the beginning of the file
        header = [b"LOGG", FILE_HEADER_SIZE,
                  APPLICATION_ID, 0, 0, 0, 2, 6, 8, 1]
        # The meaning of "count of objects read" is unknown
        header.extend([filesize, self.uncompressed_size,
                       self.count_of_objects, 0])
        header.extend(timestamp_to_systemtime(self.start_timestamp))
        header.extend(timestamp_to_systemtime(self.stop_timestamp))
        with open(self.file.name, "r+b") as f:
            f.write(FILE_HEADER_STRUCT.pack(*header))
426395
def stop(self):
        
        self._cmds_q.put(("stop",))
        for recorder in self._data_stream_recorders:
            recorder._stop()
        try:
            self._syncer.terminate()
        except Exception:
            pass
852216
def _download(self, force_overwrite=False, verbose=False):
        
        if not force_overwrite:
            # If the file is already there, we're done
            if os.path.isfile(self.filepath):
                if verbose:
                    print(
                        "File already available at %s -- skipping"
                        % (self.filepath)
                    )
                return False
        stream_download(self.URL, self.filepath, verbose=verbose)
        return True
103944
def stop_stream(self):
        

        if self.stream is not None:
            # There is a streaming thread

            logger.warning("Stopping twitter stream...")
            self.stream.disconnect()

            self.stream = None

            # wait a few seconds to allow the streaming to actually stop
            sleep(self.STOP_TIMEOUT)
575133
def download(self, force=False, silent=False):
        """"""
        def _download():
            if self.url.startswith("http"):
                self._download_http(silent=silent)
            elif self.url.startswith("ftp"):
                self._download_ftp(silent=silent)
            else:
                raise ValueError("Invalid URL %s" % self.url)
            logger.debug("Moving %s to %s" % (
                self._temp_file_name,
                self.destination))
            shutil.move(self._temp_file_name, self.destination)
            logger.debug("Successfully downloaded %s" % self.url)

        try:
            is_already_downloaded = os.path.isfile(self.destination)
            if is_already_downloaded:
                if force:
                    try:
                        os.remove(self.destination)
                    except Exception:
                        logger.error("Cannot delete %s" % self.destination)
                    logger.info(
                        "Downloading %s to %s" % (self.url, self.destination))
                    logger.debug(
                        "Downloading %s to %s" % (self.url,
                                                  self._temp_file_name))
                    _download()
                else:
                    logger.info(("File %s already exist. Use force=True if you"
                                 " would like to overwrite it.") %
                                self.destination)
            else:
                _download()
        finally:
            try:
                os.remove(self._temp_file_name)
            except OSError:
                pass
867334
def stop(self):
        """"""
        self._response['shouldEndSession'] = True
        self._response['action']['audio']['interface'] = 'stop'
        self._response['action']['audio']['sources'] = []
        return self
436541
async def stop(self):
        """"""

        if self._rpc_task is not None:
            self._rpc_task.cancel()

        try:
            await self._rpc_task
        except asyncio.CancelledError:
            pass

        self._rpc_task = None