Terminates the XML document and closes the output stream.
499100
public void close() throws IOException {
		try {
			if (!started) {
				handler.startDocument();

				if (!icalendarElementExists) {
					//don't output a <icalendar> element if the parent is a <icalendar> element
					start(ICALENDAR);
				}
			}

			if (!icalendarElementExists) {
				end(ICALENDAR);
			}
			handler.endDocument();
		} catch (SAXException e) {
			throw new IOException(e);
		}

		if (writer != null) {
			writer.close();
		}
	}
103312
public void endDocument()
    {
        logger.debug("****   endDoc   ****");
        for (Iterator iterator = conDesList.iterator(); iterator.hasNext();)
        {
            JdbcConnectionDescriptor jcd = (JdbcConnectionDescriptor) iterator.next();
            con_repository.addDescriptor(jcd);
        }
    }
594266
protected void endNode(Node node) throws org.xml.sax.SAXException
  {

    switch (node.getNodeType())
    {
    case Node.DOCUMENT_NODE :
      break;
      
    case Node.ELEMENT_NODE :
      String ns = m_dh.getNamespaceOfNode(node);
      if(null == ns)
        ns = "";
      this.m_contentHandler.endElement(ns,
                                         m_dh.getLocalNameOfNode(node),
                                         node.getNodeName());

      if (m_Serializer == null) {
      // Don't bother with endPrefixMapping calls if the ContentHandler is a
      // SerializationHandler because SerializationHandler's ignore the
      // endPrefixMapping() calls anyways. . . .  This is an optimization.    
      Element elem_node = (Element) node;    
      NamedNodeMap atts = elem_node.getAttributes();
      int nAttrs = atts.getLength();

      // do the endPrefixMapping calls in reverse order 
      // of the startPrefixMapping calls
      for (int i = (nAttrs-1); 0 <= i; i--)
      {
        final Node attr = atts.item(i);
        final String attrName = attr.getNodeName();
        final int colon = attrName.indexOf(':');
        final String prefix;

        if (attrName.equals("xmlns") || attrName.startsWith("xmlns:"))
        {
          // Use "" instead of null, as Xerces likes "" for the 
          // name of the default namespace.  Fix attributed 
          // to "Steven Murray" <smurray@ebt.com>.
          if (colon < 0)
            prefix = "";
          else
            prefix = attrName.substring(colon + 1);

          this.m_contentHandler.endPrefixMapping(prefix);
        }
        else if (colon > 0) {
            prefix = attrName.substring(0, colon);
            this.m_contentHandler.endPrefixMapping(prefix);
        }
      }
      {
          String uri = elem_node.getNamespaceURI();
          if (uri != null) {
              String prefix = elem_node.getPrefix();
              if (prefix==null)
                prefix="";
              this.m_contentHandler.endPrefixMapping(prefix);              
          }
      }
      }
      break;
    case Node.CDATA_SECTION_NODE :
      break;
    case Node.ENTITY_REFERENCE_NODE :
    {
      EntityReference eref = (EntityReference) node;

      if (m_contentHandler instanceof LexicalHandler)
      {
        LexicalHandler lh = ((LexicalHandler) this.m_contentHandler);

        lh.endEntity(eref.getNodeName());
      }
    }
    break;
    default :
    }
  }
1264056
@Override
	public void close() {
		try {
			xmlParser.close();
		} catch (Exception e) {
			e.printStackTrace();
			throw (new KriptonRuntimeException(e));
		}

	}
157799
@Override
    public void endDocument() throws SAXException {
        try {
            this.writer.close();
        } catch (IOException ioe) {
            throw (SAXException)new SAXException(ioe).initCause(ioe);
        }
    }
1061371
public function close()
    {
        if (!is_resource($this->sharedStringsFilePointer)) {
            return;
        }

        fwrite($this->sharedStringsFilePointer, '</sst>');

        // Replace the default strings count with the actual number of shared strings in the file header
        $firstPartHeaderLength = strlen(self::SHARED_STRINGS_XML_FILE_FIRST_PART_HEADER);
        $defaultStringsCountPartLength = strlen(self::DEFAULT_STRINGS_COUNT_PART);

        // Adding 1 to take into account the space between the last xml attribute and "count"
        fseek($this->sharedStringsFilePointer, $firstPartHeaderLength + 1);
        fwrite($this->sharedStringsFilePointer, sprintf("%-{$defaultStringsCountPartLength}s", 'count="' . $this->numSharedStrings . '" uniqueCount="' . $this->numSharedStrings . '"'));

        fclose($this->sharedStringsFilePointer);
    }
1269231
public void stop() {
        if (!Utils.isNullOrEmpty(context.getSettings().getExportFile())) {
            if (Utils.isNullOrEmpty(context.getSettings().getExportFilter())) {
                JAXB.marshal(export, new File(context.getSettings().getExportFile()));
            } else {
                Symbols exportFiltered = new Symbols();
                Pattern regexp = Pattern.compile(context.getSettings().getExportFilter());
                for (String symbol : export.getSymbols()) {
                    if (regexp.matcher(symbol).matches()) {
                        exportFiltered.getSymbols().add(symbol);
                    }
                }
                JAXB.marshal(exportFiltered, new File(context.getSettings().getExportFile()));
            }
        }
        if (context.getSettings().isClean()) {
            for (File file : oldFiles) {
                logInfo("deleting " + file.getName());
                if (!file.delete()) {
                    logInfo("failed");
                }
                ++deleted;
            }
        }
        try {
            final BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(java4cppHash));
            newHashes.store(out, "Generated by java4cpp");
            out.close();
        } catch (IOException e) {
            throw new RuntimeException("Failed to generate java4cpp.hash " + e.getMessage());
        }
        logInfo(String.format("generated: %d, imported: %d, skipped: %d, deleted: %d", generated, imported, skipped, deleted));
    }
802067
public void close() throws IOException {
    out.close();

    int size = stackSize;
    if (size > 1 || size == 1 && stack[size - 1] != NONEMPTY_DOCUMENT) {
      throw new IOException("Incomplete document");
    }
    stackSize = 0;
  }
944661
public void destroy() {

        CmsXmlContentUgcApi.SERVICE.destroySession(m_content.getSessionId(), new AsyncCallback<Void>() {

            public void onFailure(Throwable caught) {

                throw new RuntimeException(caught);

            }

            public void onSuccess(Void result) {

                // do nothing

            }
        });

    }
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();
	}
913516
@Override
    public void endDocument() throws SAXException {

        LOG.info("Content Processing finished, saving...");
        try {
            this.session.save();
        } catch (final RepositoryException e) {
            throw new AssertionError("Saving failed", e);
        }
        if (LOG.isInfoEnabled()) {
            LOG.info("Content imported in {} ms", (System.nanoTime() - this.startTime) / 1_000_000);
            LOG.info("END ContentImport");
        }
    }
514058
public void endDocument() throws IOException {
        endChangesIfNecessary();
        ResponseWriter writer = getWrapped();
        /*
         * Because during a <script> writing an exception can occur we need to
         * make sure the wrapped response only writes one partial-response, but
         * also calls to end the document (so we can properly cleanup in the 
         * wrapped HtmlResponseWriter). See issue #3473.
         */
        if (!(writer instanceof PartialResponseWriter)) {
            writer.endElement("partial-response");
        }
        writer.endDocument();
    }
535710
public void terminate() throws InterruptedException, IOException {
        final Computer computer = toComputer();
        if (computer != null) {
            computer.recordTermination();
        }
        try {
            // TODO: send the output to somewhere real
            _terminate(new StreamTaskListener(System.out, Charset.defaultCharset()));
        } finally {
            try {
                Jenkins.get().removeNode(this);
            } catch (IOException e) {
                LOGGER.log(Level.WARNING, "Failed to remove "+name,e);
            }
        }
    }
715160
def end_output (self, **kwargs):
        
        self.xml_endtag(u"linkchecker")
        self.xml_end_output()
        self.close_fileoutput()
1200791
@Override
    public void shutdown() throws JournalException {
        try {
            if (fileHasHeader) {
                super.writeDocumentTrailer(writer);
            }
            writer.close();
            out.close();
        } catch (XMLStreamException e) {
            throw new JournalException(e);
        } catch (IOException e) {
            throw new JournalException(e);
        }
    }
191655
def stop(self):
        """"""
        et = ET.ElementTree(self.checkstyle_element)
        f = BytesIO()
        et.write(f, encoding='utf-8', xml_declaration=True)
        xml = f.getvalue().decode('utf-8')
        if self.output_fd is None:
            print(xml)
        else:
            self.output_fd.write(xml)
        super(CheckstylePlugin, self).stop()
547931
public static void closeQuietly(final XMLStreamReader reader) {
        try {
            if (reader != null) {
                reader.close();
            }
        } catch (final Throwable t) {
            if (LOGGER.isDebugEnabled()) {
                LOGGER.debug("Ignoring exception that occurred when closing XMLStreamReader", t);
            }
        }
    }