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

x33g5p2x  于2022-01-19 转载在 其他  
字(3.6k)|赞(0)|评价(0)|浏览(126)

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

Event.getRawDocument介绍

[英]Convenience method returns the IResource as a RawDocument. The caller should confirm the Event type using isRawDocument before calling this method.
[中]便利方法将IResource作为原始文档返回。调用方应在调用此方法之前使用isRawDocument确认事件类型。

代码示例

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

@Override
protected Event handleRawDocument (final Event event) {
  URI uri = event.getRawDocument().getInputURI();
  if ( uri == null ) {
    throw new OkapiBadStepInputException("TTX Joiner expects URI inputs.");
  }
  inputList.add(uri);
  return event;
}

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

@Override
protected Event handleRawDocument (Event event) {
  RawDocument rd = event.getRawDocument();
  String tmpIn = rd.getInputURI().getPath();
  String relativeInput = tmpIn.substring(inputRootDir.length()+1);
  String relativeOutput = relativeInput; // Input and Output are the same for reference files
  
  writer.setDocumentInformation(relativeInput, "", "", "", relativeOutput, "", null);
  return writer.handleEvent(event);
}

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

@Override
public Event handleRawDocument (Event event) {
  File file = new File(event.getRawDocument().getInputURI());
  File output = new File(outputURI);
  if ( params.getCopyOption().equals("overwrite") ) {
    StreamUtil.copy(file.getPath(), output.getPath(), params.isMove());
  }
  else if ( params.getCopyOption().equals("backup") ) {
    if ( output.exists() ) {
      if ( !output.renameTo(new File(outputURI.toString() + ".bak")) ) {
        StreamUtil.copy(output.getPath(), output.getPath().replace(".txt", ".txt.bak"), true);
      }
    }
    StreamUtil.copy(file.getPath(), output.getPath(), params.isMove());
  }
  else { // skip copy/move file
    if ( !output.exists() ) {
      StreamUtil.copy(file.getPath(), output.getPath(), params.isMove());
    }
  }
  return event;
}

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

@Override
protected Event handleRawDocument (final Event event) {
  final RawDocument rawDoc = event.getRawDocument();
  //TODO: change this to support input stream instead
  URI uri = rawDoc.getInputURI();
  if ( uri == null ) {
    throw new OkapiBadStepInputException("TTX Splitter expects a URI input.");
  }
  splitter.split(uri);
  return event;
}

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

@Override
protected Event handleRawDocument (Event event) {
  RawDocument rawDoc = event.getRawDocument();
  OutputStreamWriter writer = null;
  try {

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

rawDoc = event.getRawDocument();
input = rawDoc.getStream();

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

rawDoc = event.getRawDocument();

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

@Override
  protected Void produce(OutputStream sink) throws Exception {
    try {
      skelMergerWriter.setOutput(sink);
      xlfFilter.open(event.getRawDocument());
      while (xlfFilter.hasNext()) {
        skelMergerWriter.handleEvent(xlfFilter.next());
      }                    
    } catch (Exception e) {
      close();
      throw new OkapiMergeException("Error merging from original file", e);
    } finally {
      if (xlfFilter != null) xlfFilter.close();
      skelMergerWriter.close();
      originalDocument.close();
    }
      
    return null;
  }
};

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

isDone = false;
filter.open(event.getRawDocument());

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

try (RawDocument initialDoc = event.getRawDocument();) {
  if ( Util.isEmpty(filterConfigId) ) {
    return event;

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

try {
  xlfReader = new XLIFFFilter();
  xlfReader.open(event.getRawDocument());

相关文章