use of org.beanio.StreamFactory in project camel by apache.
the class BeanIOSplitter method createStreamFactory.
protected StreamFactory createStreamFactory(CamelContext camelContext) throws Exception {
ObjectHelper.notNull(getStreamName(), "Stream name not configured.");
// Create the stream factory that will be used to read/write objects.
StreamFactory answer = StreamFactory.newInstance();
// Load the mapping file using the resource helper to ensure it can be loaded in OSGi and other environments
InputStream is = ResourceHelper.resolveMandatoryResourceAsInputStream(camelContext, getMapping());
try {
if (getProperties() != null) {
answer.load(is, getProperties());
} else {
answer.load(is);
}
} finally {
IOHelper.close(is);
}
return answer;
}
Aggregations