public final class ResourceURIDownloader extends Object implements URIDownloader
resource
URI scheme
Here, resource
is to be interpreted as a Java resource, exactly
what you would obtain using Class.getResourceAsStream(String)
.
And in fact, this is what this downloader does: it takes whatever is in
the provided URI's path (using URI.getPath()
) and tries to make an
input stream of it. The difference is that an IOException
will be
thrown if the resource cannot be found (instead of returning null
).
Modifier and Type | Method and Description |
---|---|
InputStream |
fetch(URI source)
Fetch the content at a given URI
|
static URIDownloader |
getInstance() |
public static URIDownloader getInstance()
public InputStream fetch(URI source) throws IOException
URIDownloader
fetch
in interface URIDownloader
source
- the URIInputStream
IOException
- unable to find an input stream