FileDocCategorySizeDatePackage
CallbackWriter.javaAPI DocExample2866Mon Jul 23 13:26:42 BST 2007org.apache.struts2.views.freemarker.tags

CallbackWriter

public class CallbackWriter extends Writer implements freemarker.template.TransformControl

Fields Summary
private org.apache.struts2.components.Component
bean
private Writer
writer
private StringWriter
body
private boolean
afterBody
Constructors Summary
public CallbackWriter(org.apache.struts2.components.Component bean, Writer writer)


         
        this.bean = bean;
        this.writer = writer;

        if (bean.usesBody()) {
            this.body = new StringWriter();
        }
    
Methods Summary
public intafterBody()

        afterBody = true;
        boolean result = bean.end(this, bean.usesBody() ? body.toString() : "");

        if (result) {
            return REPEAT_EVALUATION;
        } else {
            return END_EVALUATION;
        }
    
public voidclose()

        if (bean.usesBody()) {
            body.close();
        }
    
public voidflush()

        writer.flush();

        if (bean.usesBody()) {
            body.flush();
        }
    
public org.apache.struts2.components.ComponentgetBean()

        return bean;
    
public voidonError(java.lang.Throwable throwable)

        throw throwable;
    
public intonStart()

        boolean result = bean.start(this);

        if (result) {
            return EVALUATE_BODY;
        } else {
            return SKIP_BODY;
        }
    
public voidwrite(char[] cbuf, int off, int len)

        if (bean.usesBody() && !afterBody) {
            body.write(cbuf, off, len);
        } else {
            writer.write(cbuf, off, len);
        }