gpt4 book ai didi

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

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

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

WorkflowBundleIO.guessMediaTypeForSignature介绍

[英]Attempt to guess the media type for a stream or file that starts with these bytes.

All registered #getReaders() are consulted.

Return null if ambiguous (more than one possibility) or unknown.
[中]

代码示例

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

fileIn.read(firstBytes);
mediaType = guessMediaTypeForSignature(firstBytes);

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

inputStream.mark(firstBytes.length * 2);
  inputStream.read(firstBytes);
  mediaType = guessMediaTypeForSignature(firstBytes);
} finally {
  inputStream.reset();

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

@Test
public void guessMediaType() throws Exception {
  byte[] firstBytes = new byte[1024];
  getClass().getResourceAsStream(EXAMPLE_SCUFL2).read(firstBytes);        
  assertEquals(APPLICATION_VND_TAVERNA_SCUFL2_WORKFLOW_BUNDLE, bundleIO.guessMediaTypeForSignature(firstBytes));
  // Mess up the mime type string
  firstBytes[45] = 32;
  assertEquals(null, bundleIO.guessMediaTypeForSignature(firstBytes));
}

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

@Test
public void guessMediaType() throws Exception {
  byte[] firstBytes = new byte[1024];
  getClass().getResourceAsStream(AS_T2FLOW).read(firstBytes);        
  assertEquals(APPLICATION_VND_TAVERNA_T2FLOW_XML, io.guessMediaTypeForSignature(firstBytes));
  // Mess up the xmlns declaration
  firstBytes[885] = 32;
  assertEquals(null, io.guessMediaTypeForSignature(firstBytes));
}

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

assertEquals(null, bundleIO.guessMediaTypeForSignature(new byte[16]));
assertEquals("test/test", bundleIO.guessMediaTypeForSignature(new byte[4]));
assertEquals("test/test", bundleIO.guessMediaTypeForSignature(new byte[4]));		
assertEquals(null, bundleIO.guessMediaTypeForSignature(new byte[4]));

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

assertEquals("test/test", bundleIO.guessMediaTypeForSignature(new byte[4]));

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