public static InputStream getResourceAsStream ( String name , ClassLoader callerClassLoader ) { _checkResourceName ( name ) ; InputStream stream = null ; ClassLoader loader = getContextClassLoader ( ) ; if ( loader != null ) { stream = loader . getResourceAsStream ( name ) ; } if ( stream == null ) { if ( callerClassLoader != null ) { stream = callerClassLoader . getResourceAsStream ( name ) ; } else { stream = ClassLoader . getSystemResourceAsStream ( name ) ; } } return stream ; }
Locates the resource stream with the specified name . For Java 2 callers the current thread s context class loader is preferred falling back on the class loader of the caller when the current thread s context is not set or the caller is pre Java 2 . If the callerClassLoader is null then fall back on the system class loader .