public interface ResourceLoader
BaseResourceLoader
. This allows API changes to be
made to JSilver that maintain compatibility with existing ResourceLoader implementations.Modifier and Type | Method and Description |
---|---|
void |
close(Reader reader)
Close the reader.
|
Object |
getKey(String filename)
Returns an object that can be used to uniquely identify the file corresponding to the given
file name in the context of this ResourceLoader.
|
Object |
getResourceVersionId(String name)
Returns an object that can be used to identify when a resource has changed.
|
Reader |
open(String name)
Open a resource.
|
Reader |
openOrFail(String name)
Open a resource or throw an exception if no such resource is found.
|
Reader open(String name) throws IOException
close(Reader)
when done with the
reader.name
- the name of the resourceIOException
- if resource fails to openReader openOrFail(String name) throws JSilverTemplateNotFoundException, IOException
close(Reader)
when done with the
reader.name
- the name of the resourceJSilverTemplateNotFoundException
- if resource is not foundIOException
- if resource fails to openvoid close(Reader reader) throws IOException
reader
- the reader to closeIOException
- if reader fasils to closeObject getKey(String filename)
filename
- the name we want to identifyObject getResourceVersionId(String name)
Object.equals(Object)
and
Object.hashCode()
.
If the ResourceLoader does not or cannot compute a version identifier then it is sufficient to
always return the same Object, e.g. the resource name. Null, however, should only be returned
if a call to open(String)
would also return null.name
- the name of the resource to check for resourcesCopyright © 2010–2015 Google. All rights reserved.