private URLStreamHandler getURLStreamHandler ( final String protocol ) { try { final Method method = URL . class . getDeclaredMethod ( "getURLStreamHandler" , String . class ) ; method . setAccessible ( true ) ; return ( URLStreamHandler ) method . invoke ( null , protocol ) ; } catch ( final Exception e ) { if ( logger . isWarnEnabled ( ) ) { logger . warn ( "could not access URL.getUrlStreamHandler" ) ; } return null ; } }
returns the URL class s stream handler for a protocol . this uses inspection .