All Downloads are FREE. Search and download functionalities are using the official Maven repository.
Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
org.zodiac.template.base.util.TemplateUtil Maven / Gradle / Ivy
package org.zodiac.template.base.util;
import java.io.IOException;
import java.io.OutputStream;
import java.io.StringWriter;
import java.io.Writer;
import java.util.Map;
import org.zodiac.template.base.TemplateContext;
import org.zodiac.template.base.TemplateEngine;
import org.zodiac.template.base.TemplateException;
import org.zodiac.template.base.support.MappedTemplateContext;
public abstract class TemplateUtil {
public static String writeToString(TemplateEngine templateEngine, String templateLocation,
Map model) throws TemplateException, IOException {
return writeToString(templateEngine, templateLocation, new MappedTemplateContext(model));
}
public static String writeToString(TemplateEngine templateEngine, String templateLocation,
TemplateContext templateContext) throws TemplateException, IOException {
return writeToString(templateEngine, templateLocation, null, templateContext);
}
public static String writeToString(TemplateEngine templateEngine, String templateLocation,
String encoding, TemplateContext templateContext) throws TemplateException, IOException {
StringWriter result = new StringWriter();
writeTo(templateEngine, templateLocation, templateContext, result);
return result.toString();
}
public static void writeTo(TemplateEngine templateEngine, String templateLocation,
Map model, Writer writer) throws TemplateException, IOException {
writeTo(templateEngine, templateLocation, new MappedTemplateContext(model), writer);
}
public static void writeTo(TemplateEngine templateEngine, String templateLocation,
TemplateContext templateContext, Writer writer) throws TemplateException, IOException {
templateEngine.writeTo(templateLocation, templateContext, writer);
}
public static void writeTo(TemplateEngine templateEngine, String templateLocation,
Map model, OutputStream ostream) throws TemplateException, IOException {
writeTo(templateEngine, templateLocation, new MappedTemplateContext(model), ostream);
}
public static void writeTo(TemplateEngine templateEngine, String templateLocation, String encoding,
Map model, OutputStream ostream) throws TemplateException, IOException {
writeTo(templateEngine, templateLocation, new MappedTemplateContext(model), ostream);
}
public static void writeTo(TemplateEngine templateEngine, String templateLocation,
TemplateContext templateContext, OutputStream ostream) throws TemplateException, IOException {
templateEngine.writeTo(templateLocation, templateContext, ostream);
}
}