Package groovy.text
Class TemplateEngine
- java.lang.Object
-
- groovy.text.TemplateEngine
-
- Direct Known Subclasses:
GStringTemplateEngine,MarkupTemplateEngine,SimpleTemplateEngine,StreamingTemplateEngine,XmlTemplateEngine
public abstract class TemplateEngine extends Object
A template engine is a factory for creating a Template instance for a given text input.
-
-
Constructor Summary
Constructors Constructor Description TemplateEngine()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description TemplatecreateTemplate(File file)Creates a template from the File contents.TemplatecreateTemplate(File file, Charset cs)Creates a template from the File contents using the given charset encoding.abstract TemplatecreateTemplate(Reader reader)Creates a template by reading content from the Reader.TemplatecreateTemplate(String templateText)Creates a template from the String contents.TemplatecreateTemplate(URL url)Creates a template from the content found at the URL using the default encoding.TemplatecreateTemplate(URL url, Charset cs)Creates a template from the content found at the URL using the given charset encoding.
-
-
-
Method Detail
-
createTemplate
public abstract Template createTemplate(Reader reader) throws CompilationFailedException, ClassNotFoundException, IOException
Creates a template by reading content from the Reader.
-
createTemplate
public Template createTemplate(String templateText) throws CompilationFailedException, ClassNotFoundException, IOException
Creates a template from the String contents.
-
createTemplate
public Template createTemplate(File file) throws CompilationFailedException, ClassNotFoundException, IOException
Creates a template from the File contents. If the encoding for the file can be determined, that encoding will be used, otherwise the default encoding will be used. Consider usingcreateTemplate(File, Charset)if you need to explicitly set the encoding.
-
createTemplate
public Template createTemplate(File file, Charset cs) throws CompilationFailedException, ClassNotFoundException, IOException
Creates a template from the File contents using the given charset encoding.
-
createTemplate
public Template createTemplate(URL url) throws CompilationFailedException, ClassNotFoundException, IOException
Creates a template from the content found at the URL using the default encoding. Please consider usingcreateTemplate(URL, Charset).
-
createTemplate
public Template createTemplate(URL url, Charset cs) throws CompilationFailedException, ClassNotFoundException, IOException
Creates a template from the content found at the URL using the given charset encoding.
-
-