Search in sources :

Example 1 with StreamFactory

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;
}
Also used : InputStream(java.io.InputStream) StreamFactory(org.beanio.StreamFactory)

Aggregations

InputStream (java.io.InputStream)1 StreamFactory (org.beanio.StreamFactory)1