Java exec execute(Template template, Map rootMap)

Here you can find the source of execute(Template template, Map rootMap)

Description

execute

License

Apache License

Declaration

public static String execute(Template template, Map<?, ?> rootMap) 

Method Source Code


//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();
    }
}

Related

  1. execute(String... command)
  2. execute(String... commands)
  3. execute(String[] _command, String _workingDir)
  4. execute(String[] command, File directory, String[] env)
  5. execute(String[] commandArray)
  6. execute1(final String appPath)
  7. execute2(final String appPath)
  8. executeAndWait(String command)
  9. executeApplication(String filePath)