Camel: “file” component, but only pass file name as body

杀马特。学长 韩版系。学妹 提交于 2019-12-05 05:43:27

You can just pass in a java.io.File instance. This is essentially what the Camel file component does itself (although its placed inside a WrappedFile, due sharing code with the ftp components).

You can of course also just store the name of the file as a String, and then from the processor access the file, either by

String name = exchange.getIn().getBody(String.class);
File file = new File(name);
...
FileInputStream fis = new FileInputStream(file);
// read the file from the stream, etc.
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!