Last active
December 25, 2015 11:59
-
-
Save eFrane/6973266 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class JarStreamMustacheFactory extends DefaultMustacheFactory | |
{ | |
String resourceRoot; | |
public JarStreamMustacheFactory(String resourceRoot) | |
{ | |
super(resourceRoot); | |
if (!resourceRoot.endsWith("/")) resourceRoot += '/'; | |
this.resourceRoot = resourceRoot; | |
} | |
public Mustache compile(String name) | |
{ | |
if (name.charAt(0) == '/') name = name.substring(1,name.length()); | |
InputStream stream = getClass().getResourceAsStream(resourceRoot + name + ".mustache"); | |
return compile(new InputStreamReader(stream), name); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment