org.apache.camel.WrappedFile类的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(2.3k)|赞(0)|评价(0)|浏览(95)

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

WrappedFile介绍

暂无

代码示例

代码示例来源:origin: org.apache.camel/camel-jclouds

@FallbackConverter
  @SuppressWarnings("unchecked")
  public static <T extends Payload> T convertTo(Class<T> type, Exchange exchange, Object value, TypeConverterRegistry registry) throws IOException {
    Class<?> sourceType = value.getClass();
    if (type == Payload.class && WrappedFile.class.isAssignableFrom(sourceType)) {
      // attempt to convert to JClouds Payload from a file
      WrappedFile wf = (WrappedFile) value;
      if (wf.getFile() != null) {
        TypeConverter converter = registry.lookup(Payload.class, wf.getFile().getClass());
        if (converter != null) {
          return (T) converter.tryConvertTo(Payload.class, wf.getFile());
        }
      }
    }
    return null;
  }
}

代码示例来源:origin: org.apache.camel/camel-azure

private InputStream getInputStreamFromExchange(Exchange exchange) throws Exception {
  Object body = exchange.getIn().getBody();
  if (body instanceof WrappedFile) {
    // unwrap file
    body = ((WrappedFile) body).getFile();
  }
  InputStream is;
  if (body instanceof InputStream) {
    is = (InputStream) body;
  } else if (body instanceof File) {
    is = new FileInputStream((File)body);
  } else if (body instanceof byte[]) {
    is = new ByteArrayInputStream((byte[]) body);
  } else {
    // try as input stream
    is = exchange.getContext().getTypeConverter().tryConvertTo(InputStream.class, exchange, body);
  }
  if (is == null) {
    // fallback to string based
    throw new IllegalArgumentException("Unsupported blob type:" + body.getClass().getName());
  }
  return is;
}

代码示例来源:origin: org.openehealth.ipf.platform-camel/ipf-platform-camel-ihe-hl7v2

s = readFile(body, charset);
} else if(body instanceof WrappedFile<?>) {
  Object file = ((WrappedFile<?>) body).getFile();
  if(file instanceof File) {
    s = readFile(file, charset);

代码示例来源:origin: org.apache.camel/camel-tarfile

body = ((WrappedFile) body).getFile();

代码示例来源:origin: org.apache.camel/camel-zipfile

body = ((WrappedFile) body).getFile();

代码示例来源:origin: org.apache.camel/camel-solr

boolean invalid = false;
if (body instanceof WrappedFile) {
  body = ((WrappedFile<?>) body).getFile();

代码示例来源:origin: io.konig/konig-camel-aws-s3

obj = ((WrappedFile<?>)obj).getFile();

代码示例来源:origin: io.konig/konig-camel-aws-s3

obj = ((WrappedFile<?>)obj).getFile();

相关文章

WrappedFile类方法