use of org.beetl.core.io.ByteWriter_Char in project beetl2.0 by javamonkey.
the class Template method renderTo.
/**
* 获取模板输出的文本,输出到Writer里
*
* @param writer
* @throws BeetlException
*/
public void renderTo(Writer writer) throws BeetlException {
ByteWriter_Char byteWriter = new ByteWriter_Char(writer, cf.charset, ctx);
this.renderTo(byteWriter);
}
use of org.beetl.core.io.ByteWriter_Char in project beetl2.0 by javamonkey.
the class BeetlUtil method getWriterByByteWriter.
public static Writer getWriterByByteWriter(ByteWriter byteWriter) {
ByteWriter temp = null;
while ((temp = byteWriter.getParent()) != null) {
byteWriter = temp;
}
Writer w = null;
if (byteWriter instanceof ByteWriter_Char) {
ByteWriter_Char bw = (ByteWriter_Char) byteWriter;
w = bw.getW();
} else {
ByteWriter_Byte bw = (ByteWriter_Byte) byteWriter;
try {
w = new OutputStreamWriter(bw.getOs(), bw.getCs());
} catch (Exception ex) {
throw new RuntimeException(ex);
}
}
return w;
}
Aggregations