Closes an OutputStream, logging any exceptions.

@param stream the stream to close.
185089
public static void safeClose(final Closeable stream) {
		if (stream != null) {
			try {
				stream.close();
			} catch (IOException e) {
				LOG.error("Failed to close resource stream", e);
			}
		}
	}
285396
public static void closeIOStream(InputStream in, OutputStream out) {
        if (in != null) {
            try {
                in.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        if (out != null) {
            try {
                out.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
471547
public void save(OutputStream stream) throws IOException
    {
        DataOutputStream out = null;
        try
        {
            out = new DataOutputStream(new BufferedOutputStream(
                    stream));
            for (int i = 0; i < _array.length; ++i)
            {
                out.writeInt(_array[i]);
            }
        }
        finally
        {
            if (out != null)
            {
                out.close();
            }
        }
    }
412976
public void close() throws java.io.IOException{
        synchronized(this){
            if(_outHelper.isOutputStream_closed()){
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "output stream close previously completed ...return ");
                }
                return;
            }
            else{
                _outHelper.closeWork();
            }
        }
    }
485483
@Override
  public final void close()
  {
    try {
      TempBufferData tempBuffer = _tempRead;
      
      if (tempBuffer != null && ! _isReuseBuffer) {
        _tempRead = null;
        _readBuffer = null;

        tempBuffer.free();
      }

      if (_source != null) {
        StreamImpl s = _source;
        _source = null;
        s.close();
      }
    } catch (IOException e) {
      log.log(Level.FINE, e.toString(), e);
    }
  }
174760
public void close() throws IOException {
                if (channel != null && channel.isOpen()) {
                        channel.close();
                }

                buffer = null;
                channel = null;
                charBuffer = null;
                decoder = null;
                header = null;
        }
1281378
public void close()
        throws IOException
    {
        if (server != null) {
            OutputStream os = getOutputStream();
            this.os = null;

            MuxServer server = this.server;
            this.server = null;

            server.close(channel);
        }
    }
74029
public void close() throws IOException {
        if (open) {
            if (residual.length() > 0) {
                throw new IOException("Base64 error - data is not properly"
                        + "padded to 4-character groups.");
            }
            stream.close();
            open = false;
        }
    }
381413
@Override
    public void close() throws IOException {
        // Is the pipe connected?
        PipedInputStream stream = target;
        if (stream != null) {
            stream.done();
            target = null;
        }
    }
1162591
function close() {
		if ( error ) {
			debug( 'Stream was destroyed due to an error. Error: %s.', JSON.stringify( error ) );
			self.emit( 'error', error );
		}
		debug( 'Closing the stream...' );
		self.emit( 'close' );
	}
894069
public void close() {
    if (lock != null) {
      lock.lock();
    }
    this.connected = false;
    try {
      /* If a streaming result set is open, close it.*/
      skip();
    } catch (Exception e) {
      /* eat exception */
    }

    SendClosePacket.send(writer);
    closeSocket(reader, writer, socket);
    cleanMemory();
    if (lock != null) {
      lock.unlock();
    }
  }
339989
@Override
    public void close()
        throws IOException
    {
        InputStream in = _inputSource;

        if (in != null) {
            _inputSource = null;
            if (_autoClose) {
                in.close();
            }
        }
        freeBuffers();
    }
267014
@Override
    public void close() throws IOException {
        if (!closed) {
            try {
                if (!eof) {
                    exhaustInputStream(this);
                }
            } finally {
                eof = true;
                closed = true;
            }
        }
    }
20637
public void write(PrintStream stream) {
        this.output = stream;
        dispatch(base, false);
        stream.flush();
    }
798194
public void destroy() {
        if (inputStream != null)
        {
            try
            {
                inputStream.close();
            } catch (Throwable t)
            {
                LOG.warn("Error closing input stream", t);
            }
            inputStream = null;
        }
        if (outputStream != null)
        {
            try
            {
                outputStream.close();
            } catch (Throwable t)
            {
                LOG.warn("Error closing output stream", t);
            }
            outputStream = null;
        }
        if (errorStream != null)
        {
            try
            {
                errorStream.close();
            } catch (Throwable t)
            {
                LOG.warn("Error closing error stream", t);
            }
            errorStream = null;
        }
        if (ffmpeg != null)
        {
            ffmpeg.destroy();
            ffmpeg = null;
        }
        if (ffmpegKiller != null)
        {
            Runtime runtime = Runtime.getRuntime();
            runtime.removeShutdownHook(ffmpegKiller);
            ffmpegKiller = null;
        }
    }
665228
public static void copyStreamAndClose(InputStream is, OutputStream os) throws IOException {
        try {
            copyStream(is, os, DEFAULT_BUFFER_SIZE);
            // throw an exception if the close fails since some data might be lost
            is.close();
            os.close();
        }
        finally {
            // ...but still guarantee that they're both closed
            safeClose(is);
            safeClose(os);
        }
    }
869903
public void writeTo(OutputStream out) throws IOException {
        out.write(this.content);
        out.flush();
        out.close();
    }