org.codehaus.staxmate.out
Class SMBufferedElement
java.lang.Object
org.codehaus.staxmate.out.SMOutputtable
org.codehaus.staxmate.out.SMOutputContainer
org.codehaus.staxmate.out.SMOutputElement
org.codehaus.staxmate.out.SMBufferedElement
- All Implemented Interfaces:
- SMBufferable
public final class SMBufferedElement
- extends SMOutputElement
- implements SMBufferable
Buffered version of SMOutputElement; starts its life buffered,
so that it, its attributes and content are not automatically written to the
underlying stream, but only when buffered instance is released.
Since the base class properly already implements most of functionality,
there is not much extra to do in this class.
|
Field Summary |
protected boolean |
mIsBuffered
All instances are initially buffered; state will be changed when
instance is released. |
|
Method Summary |
protected boolean |
doOutput(SMOutputContext ctxt,
boolean canClose)
Method called to request that the entity output itself; either
as much as it can without closing, or as much as it can if it is to
get closed. |
boolean |
isBuffered()
|
void |
release()
Method called to signal that the node need not be buffered any more
(if not required to do so by parent/children restrictions) |
| Methods inherited from class org.codehaus.staxmate.out.SMOutputElement |
addAttribute, addAttribute, addAttribute, addAttribute, addAttribute, canOutputNewChild, childReleased, doWriteEndElement, doWriteStartElement, forceOutput, getLocalName, getNamespace, getPath, linkParent, throwClosedForAttrs, verifyAttrNS |
| Methods inherited from class org.codehaus.staxmate.out.SMOutputContainer |
addAndReleaseBuffered, addBuffered, addCData, addCData, addCharacters, addCharacters, addCharacters, addComment, addElement, addElement, addEntityRef, addProcessingInstruction, addValue, addValue, addValue, closeAllButLastChild, closeAndOutputChildren, createBufferedElement, createBufferedFragment, forceChildOutput, getContext, getNamespace, getNamespace, getParent, getPath, linkNewChild, setIndentation, throwBuffered, throwClosed, throwRelinking |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
mIsBuffered
protected boolean mIsBuffered
- All instances are initially buffered; state will be changed when
instance is released.
SMBufferedElement
protected SMBufferedElement(SMOutputContext ctxt,
java.lang.String localName,
SMNamespace ns)
Note: although signature indicates we could throw an exception,
this sub-class never does. But since super-class in itself could,
we have to declare it as potentially being thrown.
isBuffered
public boolean isBuffered()
- Specified by:
isBuffered in interface SMBufferable
- Returns:
- True if this object is still buffered; false if not
release
public void release()
throws javax.xml.stream.XMLStreamException
- Description copied from interface:
SMBufferable
- Method called to signal that the node need not be buffered any more
(if not required to do so by parent/children restrictions)
- Specified by:
release in interface SMBufferable
- Throws:
javax.xml.stream.XMLStreamException
doOutput
protected boolean doOutput(SMOutputContext ctxt,
boolean canClose)
throws javax.xml.stream.XMLStreamException
- Description copied from class:
SMOutputtable
- Method called to request that the entity output itself; either
as much as it can without closing, or as much as it can if it is to
get closed. In both cases output can fail or be only a partial one:
buffered nodes will not be output at all, and nodes with buffered
children can only be partially output.
- Overrides:
doOutput in class SMOutputElement
- Parameters:
ctxt - Output context to use for outputting this node (and
its contents)canClose - If true, indicates that the node can (and should)
be fully closed if possible. This (passing true) is usually done
when a new sibling
is added after a node (element/fragment); if so, current one
should be recursively closed. If false, should only try to output
as much as can be done without forcing closures.
- Returns:
- True if the whole node could be output, ie. neither it nor
its children are buffered.
- Throws:
javax.xml.stream.XMLStreamException