*

This method closes the document and writes it into the OutputStream
960896
@Override
public synchronized void  close(TaskAttemptContext context) throws IOException {

		try {
			this.officeWriter.close();
		}  finally {
			if (this.out!=null) {
				this.out.close();
			}
			if (this.currentReader!=null) {
				this.currentReader.close();
			}
		}
	
	
 }
1187800
@Override
  public void close() {
    try {
      if ( content != null ) content.close();
    } catch (XMLStreamException e) {
      logger.error("Failed to close underlying XMLStreamReader",e);
      throw new MarkLogicIOException(e);
      // whether that failed or not, attempt to close underlying InputStream
    } finally {
      if ( contentSource != null ) {
        try {
          contentSource.close();
        } catch (IOException e) {
          logger.error("Failed to close underlying InputStream",e);
          throw new MarkLogicIOException(e);
        }
      }
    }
  }
1366588
@Override
  public void closeWrite() throws IOException
  {
    if (_isWriteClosed) {
      return;
    }
    
    _isWriteClosed = true;
    
    SocketStream stream = _streamImpl;
    
    if (stream != null) {
      stream.closeWrite();
    }
    else if (_s != null) {
      try {
        _s.shutdownOutput();
      } catch (UnsupportedOperationException e) {
        log.log(Level.FINEST, e.toString(), e);
      } catch (Exception e) {
        log.finer(e.toString());
        log.log(Level.FINEST, e.toString(), e);
      }
    }
  }
538973
public void close() throws IOException {
		if (writer != null) {
			writer.close();
		} else if (stream != null) {
			stream.close();
		}
	}
692188
public synchronized void close() throws IOException {
    writable = false;
    if (map != null) {
      ByteArrayUtil.unmapByteBuffer(map);
      map = null;
    }
    if (lock != null) {
      lock.release();
      lock = null;
    }
    file.close();
  }
1094811
@Override
  public void close() throws IOException {
    if (!closed) {
      objectOutputStream.close();
      fileOutputStream.close();
      closed = true;
    }
  }
176375
public void endDocument() throws ODataRenderException {

        try {
            xmlWriter.writeEndDocument();
            xmlWriter.flush();
        } catch (XMLStreamException e) {
            LOG.error("Not possible to end stream XML");
            throw new ODataRenderException("Not possible to end stream XML: ", e);
        }
    }
864247
@Override
	public void close() throws IOException {

		// enforce sequential close() calls
		synchronized (CLOSE_MUTEX) {
			this.recordWriter.close(new HadoopDummyReporter());

			if (this.outputCommitter.needsTaskCommit(this.context)) {
				this.outputCommitter.commitTask(this.context);
			}
		}
	}
733211
@Override
	public void close() throws IOException {
		this.recordWriter.close(new DummyHadoopReporter());
		if (this.fileOutputCommitterWrapper.needsTaskCommit(this.jobConf, TaskAttemptID.forName(this.jobConf.get("mapred.task.id")))) {
			this.fileOutputCommitterWrapper.commitTask(this.jobConf, TaskAttemptID.forName(this.jobConf.get("mapred.task.id")));
		}
	//TODO: commitjob when all the tasks are finished
	}
283540
public static void close (OutputStream out)
    {
        if (out != null) {
            try {
                out.close();
            } catch (IOException ioe) {
                log.warning("Error closing output stream", "stream", out, "cause", ioe);
            }
        }
    }
1097867
@Override
  public void close() throws IOException {
    if (inputStream != null) {
      inputStream.close();
      inputStream = null;
    }

    if (buffer != null) {
      buffer = null;
    }
  }
785830
@Override
    public void close() throws IOException
    {
        if (!_closed) {
            _closed = true;
            _nodeCursor = null;
            _currToken = null;
        }
    }
1169999
public void endDocument() throws IOException {
		// close all unclosed tag;
		while (depth > 0) {
			endTag(elNamespace[depth], elName[depth]);
		}
		// assert depth == 0;
		// assert startTagIncomplete == false;
		finished = pastRoot = startTagIncomplete = true;
		out.flush();
	}
334036
public static void close(@CheckForNull OutputStream outputStream) {
        if (outputStream == null) {
            return;
        }

        try {
            outputStream.close();
        } catch (IOException e) {
            // Ignore
        }
    }
1110815
@Override
  public synchronized void close() throws Exception {
    if (this.readerWriter != null && !this.writerClosed) {
      this.readerWriter.close();
      this.writerClosed = true;
    }
  }
1063196
@Override
    public void closeFile() throws JournalException {
        try {
            super.testStateChange(State.FILE_CLOSED);
            parent.writeDocumentTrailer(xmlWriter);
            xmlWriter.close();

            /*
             * SOME implementations of XMLWriter do not close all resources, so
             * we need to close the rmi manually just in case.
             */
            try {
                writer.close();
            } catch (IOException e) {
                throw new JournalException(e);
            }
            super.setState(State.FILE_CLOSED);
        } catch (XMLStreamException e) {
            throw new JournalException(e);
        }
    }
361050
public void endDocument() throws org.xml.sax.SAXException
    {
        flushPending();
        if (m_doIndent && !m_isprevtext)
        {
            try
            {
            outputLineSep();
            }
            catch(IOException e)
            {
                throw new SAXException(e);
            }
        }

        flushWriter();
        
        if (m_tracer != null)
            super.fireEndDoc();
    }