/** * Closes the current output document if one is opened. */ public void close () { if ( writer != null ) { writer.close(); writer = null; } }
protected void finalize() throws Throwable { try { close(); } finally { super.finalize(); } }
private void endExtractedBlock () { // Close the extraction file htmlWriter.writeEndElementLineBreak(); // html htmlWriter.close(); // Check if we need to process if ( blocks.size() >= 4 ) { processExtractionBlocks(); } }
@Override protected void endWriting(OutputStream outStream) { writer.writeEndElementLineBreak(); // body writer.writeEndDocument(); writer.close(); }
/** * Saves the current rules to an SRX string. * * @param saveExtensions * true to save Okapi SRX extensions, false otherwise. * @param saveNonValidInfo * true to save non-SRX-valid attributes, false otherwise. * @return the string containing the saved SRX rules. */ public String saveRulesToString(boolean saveExtensions, boolean saveNonValidInfo) { StringWriter strWriter = new StringWriter(); XMLWriter writer = new XMLWriter(strWriter); boolean current = modified; saveRules(writer, saveExtensions, saveNonValidInfo); modified = current; // Keep the same state for modified writer.close(); return strWriter.toString(); }
@Override protected Event handleEndBatch (Event event) { matcher = null; if ( writer != null ) { writer.close(); writer = null; } if ( prnWriter != null ) { prnWriter.close(); prnWriter = null; } if ( tmx != null ) { tmx.writeEndDocument(); tmx.close(); tmx = null; } Runtime.getRuntime().gc(); if ( params.isAutoOpen() && ( pathToOpen != null )) { Util.openURL((new File(pathToOpen)).getAbsolutePath()); } return event; }
private void finishTemporaryFiles (XMLWriter htmlWriter) { // Close the temporary source input if ( htmlWriter != null ) { htmlWriter.writeEndElement(); // html htmlWriter.writeEndDocument(); htmlWriter.close(); // htmlWriter should be reset to null by the caller } // Close the original entry store if ( store != null ) { store.close(); } }
/** * Writes the end of this the document and close it. * If a <file> element is currently opened, it is closed automatically. */ public void close () { if ( writer != null ) { if ( !hasFile ) { writeStartFile(original, dataType, skeletonPath, fwConfigId, fwInputEncoding, null); } if ( inFile ) { writeEndFile(); } writer.writeEndElementLineBreak(); // xliff writer.writeEndDocument(); writer.close(); writer = null; } fwConfigId = null; fwInputEncoding = null; skeletonPath = null; }
if ( writer != null ) writer.close(); if ( prnWriter != null ) prnWriter.close();
public String toXML() { StringWriter sw = new StringWriter(); XMLWriter xml = new XMLWriter(sw); xml.writeStartDocument(); xml.writeStartElement("TranslateOptions"); xml.writeAttributeString("xmlns", "http://schemas.datacontract.org/2004/07/Microsoft.MT.Web.Service.V2"); xml.writeStartElement("Category"); xml.writeString(this.category); xml.writeEndElement(); xml.writeStartElement("ContentType"); xml.writeString(this.contentType); xml.writeEndElement(); xml.writeStartElement("ReservedFlags"); xml.writeEndElement(); xml.writeStartElement("State"); xml.writeEndElement(); xml.writeStartElement("Uri"); xml.writeEndElement(); xml.writeStartElement("User"); xml.writeString("defaultUser"); xml.writeEndElement(); xml.writeEndElement(); // !TranslateOptions xml.close(); return sw.toString(); } }
xmlWriter.close(); return sw.toString();
if ( XR != null ) { XR.writeEndDocument(); XR.close();
} finally { if (writer != null) writer.close();