⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 callbackwriter.java

📁 struts 2 核心包 的源码 有错误是难免的
💻 JAVA
字号:
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   CallbackWriter.java

package org.apache.struts2.views.freemarker.tags;

import freemarker.template.TemplateModelException;
import freemarker.template.TransformControl;
import java.io.*;
import org.apache.struts2.components.Component;

public class CallbackWriter extends Writer
	implements TransformControl
{

	private Component bean;
	private Writer writer;
	private StringWriter body;
	private boolean afterBody;

	public CallbackWriter(Component bean, Writer writer)
	{
		afterBody = false;
		this.bean = bean;
		this.writer = writer;
		if (bean.usesBody())
			body = new StringWriter();
	}

	public void close()
		throws IOException
	{
		if (bean.usesBody())
			body.close();
	}

	public void flush()
		throws IOException
	{
		writer.flush();
		if (bean.usesBody())
			body.flush();
	}

	public void write(char cbuf[], int off, int len)
		throws IOException
	{
		if (bean.usesBody() && !afterBody)
			body.write(cbuf, off, len);
		else
			writer.write(cbuf, off, len);
	}

	public int onStart()
		throws TemplateModelException, IOException
	{
		boolean result = bean.start(this);
		return !result ? 0 : 1;
	}

	public int afterBody()
		throws TemplateModelException, IOException
	{
		afterBody = true;
		boolean result = bean.end(this, bean.usesBody() ? body.toString() : "");
		return !result ? 1 : 0;
	}

	public void onError(Throwable throwable)
		throws Throwable
	{
		throw throwable;
	}

	public Component getBean()
	{
		return bean;
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -