public Template createTemplate(Resource resource, String encoding) {
groovy.text.Template template = null;
try {
template = templateEngine.createTemplate(new InputStreamReader(resource.getInputStream()));
} catch (ClassNotFoundException cnfe) {
throw new TemplateCreationException("Could not create groovy template from resource '" +
resource.getDescription() + "'", cnfe);
} catch (IOException ioe) {
throw new TemplateCreationException("Could not create groovy template from resource '" +
resource.getDescription() + "'", ioe);
}
return new GroovyTemplate(template);
}