gpt4 book ai didi

org.apache.taverna.scufl2.api.io.WorkflowBundleIO.getWriterForMediaType()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-26 09:47:05 26 4
gpt4 key购买 nike

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

WorkflowBundleIO.getWriterForMediaType介绍

[英]Returns a WorkflowBundleWriter for the specified media type. If there is more than one WorkflowBundleWriter for the specified media type the first writer discovered is returned. Subsequent calls to this method may return a different writer. If there is no WorkflowBundleWriter for the specified media type null is returned.
[中]返回指定媒体类型的WorkflowBundleWriter。如果指定的媒体类型有多个WorkflowBundleWriter,则返回发现的第一个写入程序。对该方法的后续调用可能会返回另一个writer。如果指定的媒体类型没有WorkflowBundleWriter,则返回null

代码示例

代码示例来源:origin: org.apache.taverna.language/taverna-scufl2-api

WorkflowBundleWriter writer = getWriterForMediaType(mediaType);
if (writer == null)
  throw new IllegalArgumentException(

代码示例来源:origin: org.apache.taverna.language/taverna-scufl2-api

WorkflowBundleWriter writer = getWriterForMediaType(mediaType);
if (writer == null)
  throw new IllegalArgumentException(

代码示例来源:origin: org.apache.taverna.language/taverna-scufl2-api

@Test
public void getWriterForUnknownMediaType() throws Exception {
  assertNull(bundleIO
      .getWriterForMediaType("application/vnd.example.unknownStuff"));
}

代码示例来源:origin: org.apache.taverna.language/taverna-scufl2-api

@Test
public void getWriterForMediaType() throws Exception {
  WorkflowBundleWriter writer = bundleIO
  .getWriterForMediaType(TEXT_VND_TAVERNA_SCUFL2_STRUCTURE);
  assertTrue(writer instanceof StructureWriter);
}

代码示例来源:origin: org.apache.taverna.language/taverna-scufl2-api

@Test
public void setWriters() {
  WorkflowBundleWriter myWriter = new WorkflowBundleWriter() {
    @Override
    public Set<String> getMediaTypes() {
      return Collections.singleton("application/vnd.example.myOwn");
    }
    @Override
    public void writeBundle(WorkflowBundle wfBundle, File destination,
        String mediaType) {
    }
    @Override
    public void writeBundle(WorkflowBundle wfBundle,
        OutputStream output, String mediaType) {
    }
  };
  bundleIO.setWriters(Collections.singletonList(myWriter));
  assertEquals(1, bundleIO.getWriters().size());
  assertSame(myWriter, bundleIO.getWriters().get(0));
  assertSame(myWriter,
      bundleIO.getWriterForMediaType("application/vnd.example.myOwn"));
  // Should now be null
  assertNull(bundleIO
      .getWriterForMediaType(TEXT_VND_TAVERNA_SCUFL2_STRUCTURE));
}

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