public static String readResource(String name, ClassLoader classLoader) throws IOException {
        String configString = "";
        InputStream is = classLoader.getResourceAsStream(name);
        if (is == null) {
            throw new RuntimeException("Cannot read resource: " + name);
        }
        try {
            configString = new Scanner(is, Charset.defaultCharset().name()).useDelimiter("\\A").next();
        } finally {
            is.close();
        }
        return configString;
    }
public static String readResource ( String name , ClassLoader classLoader ) throws IOException { String configString = "" ; InputStream is = classLoader . getResourceAsStream ( name ) ; if ( is == null ) { throw new RuntimeException ( "Cannot read resource: " + name ) ; } try { configString = new Scanner ( is , Charset . defaultCharset ( ) . name ( ) ) . useDelimiter ( "\\A" ) . next ( ) ; } finally { is . close ( ) ; } return configString ; }
@param name Resource name to use.
@param classLoader Classloader to use
@return The configuration string
@throws IOException Thrown if data couldn't be loaded