Top Description Constructors Methods
groovy.text

public abstract Class TemplateEngine

extends Object
Class Inheritance
Known Direct Subclasses
groovy.text.XmlTemplateEngine, groovy.text.markup.MarkupTemplateEngine, groovy.text.GStringTemplateEngine, groovy.text.SimpleTemplateEngine, groovy.text.StreamingTemplateEngine
Imports
edu.umd.cs.findbugs.annotations.SuppressFBWarnings, groovy.util.CharsetToolkit, org.codehaus.groovy.control.CompilationFailedException, java.io.File, .FileInputStream, .IOException, .InputStreamReader, .Reader, .StringReader, java.net.URL, java.nio.charset.Charset

A template engine is a factory for creating a Template instance for a given text input.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public abstract Template
createTemplate(Reader reader)

Creates a template by reading content from the Reader.

public Template
createTemplate(String templateText)

Creates a template from the String contents.

public Template
createTemplate(File file)

Creates a template from the File contents.

public Template
createTemplate(File file, Charset cs)

Creates a template from the File contents using the given charset encoding.

public Template
createTemplate(URL url)

Creates a template from the content found at the URL using the default encoding.

public Template
createTemplate(URL url, Charset cs)

Creates a template from the content found at the URL using the given charset encoding.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

TemplateEngineback to summary
public TemplateEngine()

Method Detail

createTemplateback to summary
public abstract Template createTemplate(Reader reader) throws CompilationFailedException, ClassNotFoundException, IOException

Creates a template by reading content from the Reader.

createTemplateback to summary
public Template createTemplate(String templateText) throws CompilationFailedException, ClassNotFoundException, IOException

Creates a template from the String contents.

createTemplateback to summary
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 using createTemplate(File, Charset) if you need to explicitly set the encoding.

createTemplateback to summary
public Template createTemplate(File file, Charset cs) throws CompilationFailedException, ClassNotFoundException, IOException

Creates a template from the File contents using the given charset encoding.

createTemplateback to summary
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 using createTemplate(URL, Charset).

Annotations
@SuppressFBWarnings:DM_DEFAULT_ENCODING
justification:left for legacy reasons but users expected to heed warning
createTemplateback to summary
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.