public static Reader resource ( String resourceName ) { if ( resourceName == null ) { throw new NullPointerException ( "'null' passed instead of resource name" ) ; } final InputStream resourceStream = ClassLoader . getSystemResourceAsStream ( resourceName ) ; if ( resourceStream == null ) { throw new IllegalArgumentException ( format ( "resource '%s' not found" , resourceName ) ) ; } return new BufferedReader ( new InputStreamReader ( resourceStream ) ) ; }
Helper method to read a classpath resource .