public Writer getWriter(Writer out,
Map args) throws IOException, TemplateModelException {
try
{
Environment env = Environment.getCurrentEnvironment();
env.include(template);
}
catch(TemplateModelException e)
{
throw e;
}
catch(IOException e)
{
throw e;
}
catch(RuntimeException e)
{
throw e;
}
catch(Exception e)
{
throw new TemplateModelException(e);
}
return new Writer(out)
{
public void close()
{
}
public void flush() throws IOException
{
out.flush();
}
public void write(char[] cbuf, int off, int len) throws IOException
{
out.write(cbuf, off, len);
}
};
}
|