/*
(non-Javadoc)

@see java.io.InputStream#close()
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;
    }
884954
public void close() {
    // Close the underlying streams
    super.close();

    // Close the socket
    if (socket != null) {
      try {
        socket.close();
      } catch (IOException iox) {
        LOGGER.warn("Could not close socket.", iox);
      }
      socket = null;
    }
  }
575838
public void close() throws IOException {
        if (mPositionReader != null) {
            mPositionReader.close();
        }

        mPositionReader = null;
        mPositionReaderUnit = null;
    }
880448
@Override
    public final void close() {
        dispose();

        if (this.outputStream != null) {
            try {
                this.outputStream.close();
            } catch (IOException ioe) {
                logger.error("Unable to close output stream.", ioe);
            } finally {
                this.outputStream = null;
            }
        }
    }
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();
            }
        }
    }
1089786
public static void safelyClose(OutputStream stream) {
		if(stream != null) {
			try {
				stream.close();
			} catch(IOException e) {
				logger.warn("error closing internal output stream, this may lead to a stream leak", e);
			}
		}
	}
420675
public void close() throws IOException {
        if (jarOutputStream != null) {
            jarOutputStream.close();
        }
        else if (os != null) {
            os.close();
        }
    }
474586
public void close() throws IOException {
        if (!closed) {
            this.finish();
            this.buffer.close();
            out.close();
            closed = true;
        }
    }
1107054
@Override
    public void close() {
        if (unprocessed != null) {
            try {
                unprocessed.forEach(ByteBuf::release);
            } finally {
                unprocessed = null;
            }

            if (endOfStream) {
                listener.endOfStream();
            }
        }
    }
433857
@Override
  public void close() throws IOException {

    if (Files.exists(outFile)) {
      Files.delete(outFile);
    }

    if (Files.exists(errFile)) {
      Files.delete(errFile);
    }

    if (Files.exists(resultFile)) {
      Files.delete(resultFile);
    }
  }
1374457
public void close() throws IOException {
        if (fInputStream != null) {
            fInputStream.close();
            fInputStream = null;
            fData = null;
        }
    }
285325
@Override
	@SuppressWarnings("resource")
	public void close() throws IOException {
		flush();

		if (this.tempStream != null) {
			this.tempStream.close();
			this.tempStream = null;
		}

		if (this.stream != null && this.stream.isOpen()) {

			// Copy the channels
			if (this.buffer != null && this.tempFile != null) {
				try {
					try (ReadableByteChannel in = Channels.newChannel(new FileInputStream(this.tempFile))) {
						final ByteBuffer hbuffer = ByteBuffer.allocate(100);
						in.read(hbuffer);

						hbuffer.limit(100);
						hbuffer.position(6 * 4);
						hbuffer.order(ByteOrder.BIG_ENDIAN);
						hbuffer.putInt(toESRIWords(this.bufferPosition));
						hbuffer.rewind();
						this.stream.write(hbuffer);

						int nbRead;
						this.buffer.rewind();

						while ((nbRead = in.read(this.buffer)) >= 0) {
							this.buffer.rewind();
							this.buffer.limit(nbRead);
							this.stream.write(this.buffer);
							this.buffer.rewind();
							this.buffer.limit(this.buffer.capacity());
						}
					}

				} finally {
					this.tempFile.delete();
					this.tempFile = null;
				}

			}
			this.stream.close();
		}
	}
948480
public function close()
    {
        if ($this->stream === null) {
            return;
        }
        $this->flush();
        if (false === @fclose($this->stream)) {
            $metaData = stream_get_meta_data($this->stream);
            $resource = $metaData["uri"];
            $msg = "Cannot close " . $resource . ": $php_errormsg";
            throw new IOException($msg);
        }
        $this->stream = null;
    }
689412
public void close() throws IOException
  {
    unlock();

    _fileChannel = null;

    InputStream is = _is;
    _is = null;
    
    if (is != null)
      is.close();
  }
1176222
protected synchronized void close() {

        this.closed = true;

        setReadable(false);
        setWritable(false);
        freeOutputStream();
        freeInputStream();

        this.gzdata = null;
    }
1239600
@Override
  public synchronized void close() throws IOException {
    if (channel != null) {
      long startTime = System.nanoTime();
      logger.atFine().log("close: file: %s, totalBytesRead: %d", gcsPath, totalBytesRead);
      channel.close();
      long duration = System.nanoTime() - startTime;
      ghfs.increment(GoogleHadoopFileSystemBase.Counter.READ_CLOSE);
      ghfs.increment(GoogleHadoopFileSystemBase.Counter.READ_CLOSE_TIME, duration);
      long streamDuration = System.nanoTime() - initTime;
      ghfs.increment(GoogleHadoopFileSystemBase.Counter.INPUT_STREAM);
      ghfs.increment(GoogleHadoopFileSystemBase.Counter.INPUT_STREAM_TIME, streamDuration);
    }
  }
1119002
@Override
    public final void close() {
        if (this.inputReader != null) {
            try {
                this.inputReader.close();
            } catch (IOException ioe) {
                logger.error("Unable to close input reader.", ioe);
            } finally {
                this.inputReader = null;
            }
        }

        dispose();
    }