Search in sources :

Example 1 with ByteWriter_Byte

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);
}
Also used : ByteWriter_Byte(org.beetl.core.io.ByteWriter_Byte)

Example 2 with ByteWriter_Byte

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;
}
Also used : ByteWriter_Char(org.beetl.core.io.ByteWriter_Char) ByteWriter_Byte(org.beetl.core.io.ByteWriter_Byte) ByteWriter(org.beetl.core.ByteWriter) OutputStreamWriter(java.io.OutputStreamWriter) Writer(java.io.Writer) OutputStreamWriter(java.io.OutputStreamWriter) ByteWriter(org.beetl.core.ByteWriter) URISyntaxException(java.net.URISyntaxException) IOException(java.io.IOException)

Aggregations

ByteWriter_Byte (org.beetl.core.io.ByteWriter_Byte)2 IOException (java.io.IOException)1 OutputStreamWriter (java.io.OutputStreamWriter)1 Writer (java.io.Writer)1 URISyntaxException (java.net.URISyntaxException)1 ByteWriter (org.beetl.core.ByteWriter)1 ByteWriter_Char (org.beetl.core.io.ByteWriter_Char)1