public static InputStream getResourceAsStream ( String resource ) throws IOException { InputStream in = null ; ClassLoader loader = ResourcesUtils . class . getClassLoader ( ) ; if ( loader != null ) { in = loader . getResourceAsStream ( resource ) ; } if ( in == null ) { in = ClassLoader . getSystemResourceAsStream ( resource ) ; } if ( in == null ) { throw new IOException ( "Could not find resource " + resource ) ; } return in ; }
Returns a resource on the classpath as a Stream object