public static InputStream getResourceAsStream(String name, Class<?> cls)
            throws IOException {
        if (cls == null) {
            cls = IOUtil.class;
        }
        if (name == null) {
            throw new IllegalArgumentException("resource cannot be null");
        }
        InputStream result = cls.getResourceAsStream(name);
        if (result == null) {
            throw new IOException("Could not open resource " + name
                    + " using " + cls.getName() + "'s class loader");
        }
        return result;
    }
public static InputStream getResourceAsStream ( String name , Class < ? > cls ) throws IOException { if ( cls == null ) { cls = IOUtil . class ; } if ( name == null ) { throw new IllegalArgumentException ( "resource cannot be null" ) ; } InputStream result = cls . getResourceAsStream ( name ) ; if ( result == null ) { throw new IOException ( "Could not open resource " + name + " using " + cls . getName ( ) + "'s class loader" ) ; } return result ; }
Finds a resource with a given name using the class loader of the
specified class. Functions identically to
{@link Class#getResourceAsStream(java.lang.String)}, except it throws an
{@link IllegalArgumentException} if the specified resource name is
<code>null</code>, and it throws an {@link IOException} if no resource
with the specified name is found.

@param name name {@link String} of the desired resource. Cannot be
<code>null</code>.
@param cls the {@link Class} whose loader to use.
@return an {@link InputStream}.
@throws IOException if no resource with this name is found.