public InputStream getAsStream ( ) throws CacheException { InputStream stream = null ; try { logger . debug ( "opening connection..." ) ; stream = url . openConnection ( proxy != null ? proxy : Proxy . NO_PROXY ) . getInputStream ( ) ; if ( stream == null ) { logger . error ( "error opening stream" ) ; } else { logger . debug ( "stream opened" ) ; } } catch ( IOException e ) { logger . error ( "error accessing url '{}'" , url ) ; throw new CacheException ( "error accessing url " + url , e ) ; } return stream ; }
Accesses the given URL and returns its contents as a stream .