Terminates an open stream and returns the filename
        of the file containing the streamed data.
768397
def close_stream(self):
        
        if self.fout:
            fout = self.fout
            fout_fn = self.fout_fn
            self.fout.flush()
            self.fout.close()
            self.fout = None
            self.fout_fn = None
            return fout_fn
654752
def stream_destroy(stream):
    
    OPENJP2.opj_stream_destroy.argtypes = [STREAM_TYPE_P]
    OPENJP2.opj_stream_destroy.restype = ctypes.c_void_p
    OPENJP2.opj_stream_destroy(stream)
1072116
def _filename(self_or_cls, filename):
        ""
        if not filename.endswith(self_or_cls.file_ext):
            return '%s.%s' % (filename, self_or_cls.file_ext)
        else:
            return filename
1104343
private String readAndClose(final InputStream stream) throws IOException {
		String contents = null;

		if (stream != null) {
			contents = CharStreams.toString(new InputStreamReader(new BufferedInputStream(stream), "UTF-8"));
			stream.close();
		}

		return contents;
	}
1007867
private function trimStream() {

        // Get the current position after we have found the element.
        $position = strpos($this->stream, $this->loader->getElement()) + 1;

        while($this->getStream()) {
            $streamLength = mb_strlen($this->stream);

            for($i = $position; $i < $streamLength; $i++) {

                if(!ctype_space($this->stream{$i}) && $this->stream{$i} == '[' ) {
                    // The stream will now read in the entire object
                    $this->stream = substr($this->stream, ++$i);
                    // Edge case where array was last char in string
                    if($this->stream === false) $this->stream = "";
                    // We are done here.
                    return true;
                }

            }
        }

        $this->arrayEnd = true;
        return false;
    }
767878
@Override
    public void close() throws IOException {
        if (isClosed()) {
            return;
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "Closing stream: " + this);
        }
        //adding MultiRead option
        if (!this.enableMultiReadofPostData) {
            if (null != this.buffer) {
                this.buffer.release();
                this.buffer = null;
            }
            validate();
        } else {
            if (null != this.buffer) {
                if (firstReadCompleteforMulti) {
                    this.buffer.rewind(); // make position 0, the buffer is ready for next read
                } else {
                    this.buffer.release();
                }
                this.buffer = null;
            }
            validate();
            if (obs != null) {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "Alert for close , obs -->" + obs + " buffer ->" + this);
                }
                obs.alertISClose();
            }
            this.firstReadCompleteforMulti = true;
            this.postDataIndex = 0;
        }
        this.closed = true;
    }
10976
@GwtIncompatible("Unnecessary")
  protected OutputStream filenameToOutputStream(String fileName) throws IOException {
    if (fileName == null){
      return null;
    }
    return new FileOutputStream(fileName);
  }
1086990
def _stream_out(self, outfile, append=False):
        '''
        
        '''
        if type(outfile) in (str, unicode):
            outfile = os.path.expanduser(os.path.expandvars(outfile))
            outfile = open(outfile, 'a' if append else 'w')
        self._run(outfile)
        self._pop.wait()
669685
@Override
    public long skip(long n) throws IOException {
        //Return -1 here because if we are closed or finished, we're at the end of the stream
        if(isClosed || isFinished()){
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                Tr.debug(tc, "Nothing to read, stream is closed : " + isClosed + ", or finished : " + isFinished());
            return -1;
        }
        
        return super.skip(n);
    }
277795
def close(self):
        '''
        

        '''

        if self.compressed_file is None:
            with self.path.open('rb+') as f:
                f.seek(0, 2)
                eof = f.tell()
                self._update_offset_value(f, self.gdr_head+36, 8, eof)
                if self.checksum:
                    f.write(self._md5_compute(f))
            return
# %%
        with self.path.open('rb+') as f:
            f.seek(0, 2)
            eof = f.tell()
            self._update_offset_value(f, self.gdr_head+36, 8, eof)

            with self.compressed_file.open('wb+') as g:
                g.write(bytearray.fromhex(CDF.V3magicNUMBER_1))
                g.write(bytearray.fromhex(CDF.V3magicNUMBER_2c))
                self._write_ccr(f, g, self.compression)

                if self.checksum:
                    g.seek(0, 2)
                    g.write(self._md5_compute(g))

        self.path.unlink()  # NOTE: for Windows this is necessary
        self.compressed_file.rename(self.path)
117033
def output_file_name(self):
    """"""

    safe_path = re.sub(r":|/", "_", self.source_urn.Path().lstrip("/"))
    return "results_%s%s" % (safe_path, self.output_file_extension)
18854
private static File extract(String name, InputStream is) throws IOException {
        byte[] buf = new byte[4096];
        int len;

        File lib = File.createTempFile(name, "lib");
        FileOutputStream os = new FileOutputStream(lib);

        try {
            while ((len = is.read(buf)) > 0) {
                os.write(buf, 0, len);
            }
        } catch (IOException e) {
            lib.delete();
            throw e;
        } finally {
            os.close();
            is.close();
        }

        return lib;
    }
510509
def close_file_from_name(self, filename):
        """"""
        filename = osp.abspath(to_text_string(filename))
        index = self.editorstacks[0].has_filename(filename)
        if index is not None:
            self.editorstacks[0].close_file(index)
1321621
private static void skipToEnd(final ImageInputStream stream) throws IOException {
        if (stream.length() > 0) {
            // Seek to end of file
            stream.seek(stream.length());
        }
        else {
            // Skip to end
            long lastGood = stream.getStreamPosition();

            while (stream.read() != -1) {
                lastGood = stream.getStreamPosition();
                stream.skipBytes(1024);
            }

            stream.seek(lastGood);

            while (true) {
                if (stream.read() == -1) {
                    break;
                }
                // Just continue reading to EOF...
            }
        }
    }
199
def end(self, close_fileobj=True):
        """"""
        log.debug("in TftpContext.end - closing socket")
        self.sock.close()
        if close_fileobj and self.fileobj is not None and not self.fileobj.closed:
            log.debug("self.fileobj is open - closing")
            self.fileobj.close()
745012
private void closeFLACStream() throws IOException {
    //reset position in output stream to beginning.
    //re-write the updated stream info.
    checkForThreadErrors();
    if(DEBUG_LEV > 0)
      System.err.println("FLACEncoder::closeFLACStream : Begin");
    streamLock.lock();
    try {
      if(!flacStreamIsOpen)
        throw new IllegalStateException("Cannot close a non-opened stream");
      byte[] md5Hash = md5.getMD().digest();
      flacWriter.closeFLACStream(md5Hash, streamConfig);
      flacStreamIsOpen = false;
    } finally {
       streamLock.unlock();
    }
  }
993555
void closeImpl()
  {
    ReadStreamOld is = _is;
    _is = null;

    WriteStreamOld os = _os;
    _os = null;

    try {
      if (is != null)
        is.close();
    } catch (Throwable e) {
      log.log(Level.FINER, e.toString(), e);
    }

    try {
      if (os != null)
        os.close();
    } catch (Throwable e) {
      log.log(Level.FINER, e.toString(), e);
    }

    if (is != null) {
      _connProbe.end();

      if (_requestStartTime > 0)
        _requestTimeProbe.end(_requestStartTime);

      if (_isIdle)
        _idleProbe.end();
    }
  }