use of org.beetl.core.io.ByteWriter_Byte in project beetl2.0 by javamonkey.
the class Template method renderTo.
/**
* 获取模板输出的文本,输出到OutputStream里,tempalte必须在二进制输出模式下才能使用
*
* @param os
* @throws BeetlException
*/
public void renderTo(OutputStream os) throws BeetlException {
ByteWriter_Byte byteWriter = new ByteWriter_Byte(os, cf.charset, ctx);
this.renderTo(byteWriter);
}
use of org.beetl.core.io.ByteWriter_Byte 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