com.google.clearsilver.jsilver.resourceloader
Class FileSystemResourceLoader
java.lang.Object
com.google.clearsilver.jsilver.resourceloader.BaseResourceLoader
com.google.clearsilver.jsilver.resourceloader.BufferedResourceLoader
com.google.clearsilver.jsilver.resourceloader.FileSystemResourceLoader
- All Implemented Interfaces:
- ResourceLoader
public class FileSystemResourceLoader
- extends BufferedResourceLoader
Loads resources from a directory.
- See Also:
ResourceLoader
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FileSystemResourceLoader
public FileSystemResourceLoader(File rootDir)
FileSystemResourceLoader
public FileSystemResourceLoader(String rootDir)
open
public Reader open(String name)
throws IOException
- Description copied from interface:
ResourceLoader
- Open a resource. If this resource is not found, null should be returned.
The caller of this method is guaranteed to call
ResourceLoader.close(Reader)
when done with the
reader.
- Parameters:
name
- the name of the resource
- Returns:
- Reader, or null if not found.
- Throws:
IOException
- if resource fails to open
openOrFail
public Reader openOrFail(String name)
throws JSilverTemplateNotFoundException,
IOException
- Description copied from interface:
ResourceLoader
- Open a resource or throw an exception if no such resource is found.
The caller of this method is guaranteed to call
ResourceLoader.close(Reader)
when done with the
reader.
- Parameters:
name
- the name of the resource
- Returns:
- Reader, or null if not found.
- Throws:
JSilverTemplateNotFoundException
- if resource is not found
IOException
- if resource fails to open
getResourceVersionId
public Object getResourceVersionId(String filename)
- Some applications, e.g. online help, need to know when a file has changed due to a symlink
modification hence the use of
File.getCanonicalFile()
, if possible.
- Specified by:
getResourceVersionId
in interface ResourceLoader
- Overrides:
getResourceVersionId
in class BaseResourceLoader
- Parameters:
filename
- the name of the resource to check for resources
- Returns:
- unique identifier for the current version of the resource or null if the resource
cannot be found
Copyright © 2010-2012 Google. All Rights Reserved.