Here you can find the source of execute(Template template, Map, ?> rootMap)
public static String execute(Template template, Map<?, ?> rootMap)
//package com.java2s; //License from project: Apache License import java.io.BufferedWriter; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.StringWriter; import java.io.Writer; import java.util.Map; import freemarker.template.Template; import freemarker.template.TemplateException; public class Main { public static String execute(Template template, Map<?, ?> rootMap) { Writer out = new BufferedWriter(new OutputStreamWriter(System.out)); StringWriter out2 = new StringWriter(); try {/*from ww w . j ava2 s.co m*/ template.process(rootMap, out); template.process(rootMap, out2); out.flush(); out2.flush(); out2.close(); } catch (TemplateException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return out2.getBuffer().toString(); } }