BodyContent (Java EE 5 SDK)

Java

Java EE 5 SDK

深圳电信培训中心.徐海蛟老师.


javax.servlet.jsp.tagext Class BodyContent

java.lang.Object
  extended by java.io.Writer
      extended by javax.servlet.jsp.JspWriter
          extended by javax.servlet.jsp.tagext.BodyContent
所有已实现的接口:
Closeable, Flushable, Appendable

public abstract class BodyContent
extends JspWriter

An encapsulation of the evaluation of the body of an action so it is available to a tag handler. BodyContent is a subclass of JspWriter.

Note that the content of BodyContent is the result of evaluation, so it will not contain actions and the like, but the result of their invocation.

BodyContent has methods to convert its contents into a String, to read its contents, and to clear the contents.

The buffer size of a BodyContent object is unbounded. A BodyContent object cannot be in autoFlush mode. It is not possible to invoke flush on a BodyContent object, as there is no backing stream.

Instances of BodyContent are created by invoking the pushBody and popBody methods of the PageContext class. A BodyContent is enclosed within another JspWriter (maybe another BodyContent object) following the structure of their associated actions.

A BodyContent is made available to a BodyTag through a setBodyContent() call. The tag handler can use the object until after the call to doEndTag().


字段摘要
 
Fields inherited from class javax.servlet.jsp.JspWriter
autoFlush, bufferSize, DEFAULT_BUFFER, NO_BUFFER, UNBOUNDED_BUFFER
 
Fields inherited from class java.io.Writer
lock
 
构造器摘要
protected BodyContent(JspWriter e)
          Protected constructor.
 
方法摘要
 void clearBody()
          Clear the body without throwing any exceptions.
 void flush()
          Redefined flush() so it is not legal.
 JspWriter getEnclosingWriter()
          Get the enclosing JspWriter.
abstract  Reader getReader()
          Return the value of this BodyContent as a Reader.
abstract  String getString()
          Return the value of the BodyContent as a String.
abstract  void writeOut(Writer out)
          Write the contents of this BodyContent into a Writer.
 
类方法继承 javax.servlet.jsp.JspWriter
clear, clearBuffer, close, getBufferSize, getRemaining, isAutoFlush, newLine, print, print, print, print, print, print, print, print, print, println, println, println, println, println, println, println, println, println, println
 
类方法继承 java.io.Writer
append, append, append, write, write, write, write, write
 
类方法继承 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造器详细信息

BodyContent

protected BodyContent(JspWriter e)
Protected constructor. Unbounded buffer, no autoflushing.

参数:
e - the enclosing JspWriter

方法详细信息

flush

public void flush()
           throws IOException
Redefined flush() so it is not legal.

It is not valid to flush a BodyContent because there is no backing stream behind it.

规范说明:
flush in interface Flushable
规范说明:
flush in class JspWriter
抛出异常:
IOException - always thrown

clearBody

public void clearBody()
Clear the body without throwing any exceptions.


getReader

public abstract Reader getReader()
Return the value of this BodyContent as a Reader.

返回:
the value of this BodyContent as a Reader

getString

public abstract String getString()
Return the value of the BodyContent as a String.

返回:
the value of the BodyContent as a String

writeOut

public abstract void writeOut(Writer out)
                       throws IOException
Write the contents of this BodyContent into a Writer. Subclasses may optimize common invocation patterns.

参数:
out - The writer into which to place the contents of this body evaluation
抛出异常:
IOException - if an I/O error occurred while writing the contents of this BodyContent to the given Writer

getEnclosingWriter

public JspWriter getEnclosingWriter()
Get the enclosing JspWriter.

返回:
the enclosing JspWriter passed at construction time

Java EE 5 SDK

深圳电信培训中心.徐海蛟老师.


提交错误或意见

版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。深圳电信培训中心.徐海蛟老师教学参考.