gpt4 book ai didi

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

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

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

WorkflowBundleIO.getWriters介绍

[英]Returns all the available WorkflowBundleWriters.
[中]返回所有可用的WorkflowBundleWriters。

代码示例

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

/**
 * Get the supported media types for writing.
 * <p>
 * Returned media types can be used with
 * {@link #writeBundle(WorkflowBundle, File, String)} and/or
 * {@link #writeBundle(WorkflowBundle, OutputStream, String)}.
 * 
 * @return A (usually sorted) set of media types
 */
public Set<String> getSupportedWriterMediaTypes() {
  Set<String> mediaTypes = new TreeSet<>();
  for (WorkflowBundleWriter writer : getWriters())
    mediaTypes.addAll(writer.getMediaTypes());
  return mediaTypes;
}

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

/**
 * Returns a <code>WorkflowBundleWriter</code> for the specified media type.
 * 
 * If there is more than one <code>WorkflowBundleWriter</code> 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 <code>WorkflowBundleWriter</code> for the specified media
 * type <code>null</code> is returned.
 * 
 * @param mediaType
 *            the media type of the <code>WorkflowBundleWriter</code>
 * @return a <code>WorkflowBundleWriter</code> for the specified media type
 */
public WorkflowBundleWriter getWriterForMediaType(String mediaType) {
  for (WorkflowBundleWriter writer : getWriters())
    if (writer.getMediaTypes().contains(mediaType))
      return writer;
  return null;
}

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

@Test
public void getWorkflowBundleWriters() throws Exception {
  assertEquals(1, bundleIO.getWriters().size());
  WorkflowBundleWriter writer = bundleIO.getWriters().get(0);
  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));
}

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