com.github.fge.jsonschema.core.load.download
Class ResourceURIDownloader

java.lang.Object
  extended by com.github.fge.jsonschema.core.load.download.ResourceURIDownloader
All Implemented Interfaces:
URIDownloader

public final class ResourceURIDownloader
extends Object
implements URIDownloader

A downloader for the custom 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).


Method Summary
 InputStream fetch(URI source)
          Fetch the content at a given URI
static URIDownloader getInstance()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static URIDownloader getInstance()

fetch

public InputStream fetch(URI source)
                  throws IOException
Description copied from interface: URIDownloader
Fetch the content at a given URI

Specified by:
fetch in interface URIDownloader
Parameters:
source - the URI
Returns:
an InputStream
Throws:
IOException - unable to find an input stream