public InputStream fetchExternalContent ( ) { final URI uri = link . getUri ( ) ; final String scheme = uri . getScheme ( ) ; LOGGER . debug ( "scheme is {}" , scheme ) ; if ( scheme != null ) { try { if ( scheme . equals ( "file" ) ) { return new FileInputStream ( uri . getPath ( ) ) ; } else if ( scheme . equals ( "http" ) || scheme . equals ( "https" ) ) { return uri . toURL ( ) . openStream ( ) ; } } catch ( final IOException e ) { throw new ExternalContentAccessException ( "Failed to read external content from " + uri , e ) ; } } return null ; }
Fetch the external content