gpt4 book ai didi

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

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

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

WorkflowBundleIO.getReaders介绍

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

代码示例

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

/**
 * Get the supported media types for reading.
 * <p>
 * Returned media types can be used with {@link #readBundle(File, String)},
 * {@link #readBundle(InputStream, String)} and/or
 * {@link #readBundle(URL, String)}.
 * 
 * @return A (usually sorted) set of media types
 */
public Set<String> getSupportedReaderMediaTypes() {
  Set<String> mediaTypes = new TreeSet<>();
  for (WorkflowBundleReader reader : getReaders())
    mediaTypes.addAll(reader.getMediaTypes());
  return mediaTypes;
}

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

/**
 * Returns a <code>WorkflowBundleReader</code> for the specified media type.
 * 
 * If there is more than one <code>WorkflowBundleReader</code> for the
 * specified media type the first reader discovered is returned. Subsequent
 * calls to this method may return a different reader.
 * 
 * If there is no <code>WorkflowBundleReader</code> for the specified media
 * type <code>null</code> is returned.
 * 
 * @param mediaType
 *            the media type of the <code>WorkflowBundleReader</code>
 * @return a <code>WorkflowBundleReader</code> for the specified media type
 */
public WorkflowBundleReader getReaderForMediaType(String mediaType) {
  for (WorkflowBundleReader reader : getReaders())
    if (reader.getMediaTypes().contains(mediaType))
      return reader;
  return null;
}

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

/**
 * Attempt to guess the media type for a stream or file that starts with
 * these bytes.
 * <p>
 * All registered {@link #getReaders()} are consulted.
 * <p>
 * Return <code>null</code> if ambiguous (more than one possibility) or
 * unknown.
 * 
 * @param firstBytes
 *            The initial bytes, at least 512 bytes long unless the resource
 *            is smaller.
 * @return The recognised media type, or <code>null</code> if the bytes were
 *         ambiguous or unknown.
 */
public String guessMediaTypeForSignature(byte[] firstBytes) {
  Set<String> mediaTypes = new HashSet<>();
  for (WorkflowBundleReader reader : getReaders()) {
    String guess = reader.guessMediaTypeForSignature(firstBytes);
    if (guess != null)
      mediaTypes.add(guess);
  }
  if (mediaTypes.isEmpty())
    return null;
  if (mediaTypes.size() > 1) {
    log.warning("Multiple media types found: " + mediaTypes);
    return null;
  }
  return mediaTypes.iterator().next();
}

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

@Test
public void getWorkflowBundleReaders() throws Exception {
  assertEquals(1, bundleIO.getReaders().size());
  WorkflowBundleReader Reader = bundleIO.getReaders().get(0);
  assertTrue(Reader instanceof StructureReader);
}

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

assertEquals(1, bundleIO.getReaders().size());
assertSame(myReader, bundleIO.getReaders().get(0));
assertSame(myReader,
    bundleIO.getReaderForMediaType("application/vnd.example.myOwn"));

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