public String getRenderedStr(final HashMap map,String temPath){
String result;
try{
Engine engine=Engine.getEngine();
final Template template=engine.getTemplate(temPath);
final PipedOutputStream pos=new PipedOutputStream();
PipedInputStream pis=new PipedInputStream(pos);
new Thread(new Runnable(){
@Override
public void run() {
try {
template.render(map,pos);
pos.close();
} catch (IOException | ParseException e) {
e.printStackTrace();
}
}
}).start();
StringWriter writer=new StringWriter();
IOUtils.copy(pis, writer, "utf-8");
result=writer.toString();
}catch (Exception e){
result="error";
e.printStackTrace();
}
return result;
}