Search in sources :

Example 1 with RuntimeIOException

use of com.notnoop.exceptions.RuntimeIOException in project camel by apache.

the class ResourceUtils method getInputStream.

public static InputStream getInputStream(String path) {
    InputStream is = null;
    if (isClasspathResource(path)) {
        String classpathResourcePath = ResourceUtils.getClasspathResourcePath(path);
        is = ResourceUtils.class.getResourceAsStream(classpathResourcePath);
        if (is == null) {
            throw new RuntimeIOException("Certificate stream is null: '" + classpathResourcePath + "'");
        }
    } else {
        try {
            is = IOHelper.buffered(new FileInputStream(path));
        } catch (FileNotFoundException e) {
            throw new RuntimeIOException(e);
        }
    }
    return is;
}
Also used : RuntimeIOException(com.notnoop.exceptions.RuntimeIOException) FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) FileNotFoundException(java.io.FileNotFoundException) FileInputStream(java.io.FileInputStream)

Aggregations

RuntimeIOException (com.notnoop.exceptions.RuntimeIOException)1 FileInputStream (java.io.FileInputStream)1 FileNotFoundException (java.io.FileNotFoundException)1 InputStream (java.io.InputStream)1