gpt4 book ai didi

net.sf.okapi.common.XMLWriter.close()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-27 04:51:05 27 4
gpt4 key购买 nike

本文整理了Java中net.sf.okapi.common.XMLWriter.close()方法的一些代码示例,展示了XMLWriter.close()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XMLWriter.close()方法的具体详情如下:
包路径:net.sf.okapi.common.XMLWriter
类名称:XMLWriter
方法名:close

XMLWriter.close介绍

[英]Closes the writer and release any associated resources.
[中]关闭编写器并释放所有相关资源。

代码示例

代码示例来源:origin: net.sf.okapi/okapi-core

/**
 * Closes the current output document if one is opened.
 */
public void close () {
  if ( writer != null ) {
    writer.close();
    writer = null;
  }
}

代码示例来源:origin: net.sf.okapi/okapi-core

protected void finalize()
  throws Throwable
{
  try {
    close();
  }
  finally {
    super.finalize();
  }
}

代码示例来源:origin: net.sf.okapi.steps/okapi-step-gttbatchtranslation

private void endExtractedBlock () {
  // Close the extraction file
  htmlWriter.writeEndElementLineBreak(); // html
  htmlWriter.close();
  // Check if we need to process 
  if ( blocks.size() >= 4 ) {
    processExtractionBlocks();
  }
}

代码示例来源:origin: net.sf.okapi.lib/okapi-lib-persistence

@Override
protected void endWriting(OutputStream outStream) {
  writer.writeEndElementLineBreak(); // body
  writer.writeEndDocument();
  writer.close();
}

代码示例来源:origin: net.sf.okapi.lib/okapi-lib-segmentation

/**
 * 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();
}

代码示例来源:origin: net.sf.okapi.steps/okapi-step-translationcomparison

@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;
}

代码示例来源:origin: net.sf.okapi.steps/okapi-step-leveraging

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();
  }
}

代码示例来源:origin: net.sf.okapi/okapi-core

/**
 * 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;
}

代码示例来源:origin: net.sf.okapi.steps/okapi-step-translationcomparison

if ( writer != null ) writer.close();
if ( prnWriter != null ) prnWriter.close();

代码示例来源:origin: net.sf.okapi.steps/okapi-step-rainbowkit

report.writeRawXML("<p><font size='2'>Note: This report was generated when creating the translation package, "
  + "the Transifex project may have been updated with other files since.</font></p>");
report.close();
if ( report != null ) report.close();
if ( pw != null ) pw.close();

代码示例来源:origin: net.sf.okapi.connectors/okapi-connector-microsoft

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();
  }
}

代码示例来源:origin: net.sf.okapi.connectors/okapi-connector-microsoft

xmlWriter.close();
return sw.toString();

代码示例来源:origin: net.sf.okapi.steps/okapi-step-translationcomparison

writer.close();

代码示例来源:origin: net.sf.okapi.steps/okapi-step-rainbowkit

if ( XR != null ) {
  XR.writeEndDocument();
  XR.close();

代码示例来源:origin: net.sf.okapi.lib/okapi-lib-segmentation

} finally {
  if (writer != null)
    writer.close();

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com