@ SuppressWarnings ( "resource" ) public InputStream getResourceAsStreamFrom ( String name , AbstractClassLoader first ) { if ( name . length ( ) == 0 ) return null ; if ( name . charAt ( 0 ) == ' ' ) name = name . substring ( 1 ) ; IO . Readable io = null ; // try with the first one if ( first != null ) try { io = first . open ( name , Task . PRIORITY_RATHER_IMPORTANT ) ; } catch ( IOException e ) { /* not there */ } // then, try on other libraries if ( io == null ) { for ( int i = 0 ; i < libs . size ( ) ; i ++ ) { AbstractClassLoader cl = libs . get ( i ) ; if ( cl == first ) continue ; try { io = cl . open ( name , Task . PRIORITY_RATHER_IMPORTANT ) ; } catch ( IOException e ) { /* not there */ } if ( io != null ) break ; } } if ( io != null ) return IOAsInputStream . get ( io , true ) ; // then try on the core one return AppClassLoader . class . getClassLoader ( ) . getResourceAsStream ( name ) ; }
Load a resource looking first into the given library .