Package com.thoughtworks.xstream.io.xml
Class AbstractPullReader
- java.lang.Object
-
- com.thoughtworks.xstream.io.AbstractReader
-
- com.thoughtworks.xstream.io.xml.AbstractXmlReader
-
- com.thoughtworks.xstream.io.xml.AbstractPullReader
-
- All Implemented Interfaces:
ErrorReporter,ExtendedHierarchicalStreamReader,HierarchicalStreamReader
- Direct Known Subclasses:
StaxReader,XppReader
public abstract class AbstractPullReader extends AbstractXmlReader
Base class that contains common functionality across HierarchicalStreamReader implementations that need to read from a pull parser.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classAbstractPullReader.Event
-
Field Summary
Fields Modifier and Type Field Description protected static intCOMMENTprivate FastStackelementStackprotected static intEND_NODEprivate FastStacklookaheadprivate FastStacklookbackprivate booleanmarkedprotected static intOTHERprivate FastStackpoolprotected static intSTART_NODEprotected static intTEXT
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractPullReader(NameCoder nameCoder)protectedAbstractPullReader(XmlFriendlyReplacer replacer)Deprecated.As of 1.4 useAbstractPullReader(NameCoder)instead
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description java.util.IteratorgetAttributeNames()Iterator with the names of the attributes.java.lang.StringgetNodeName()Get the name of the current node.java.lang.StringgetValue()Get the value (text content) of the current node.booleanhasMoreChildren()Does the node have any more children remaining that have not yet been read?voidmark()private voidmove()voidmoveDown()Select the current child as current node.voidmoveUp()Select the parent node as current node.java.lang.StringpeekNextChild()Peek the name of the next child.protected abstract java.lang.StringpullElementName()Pull the name of the current element from the stream.protected abstract intpullNextEvent()Pull the next event from the stream.protected abstract java.lang.StringpullText()Pull the contents of the current text node from the stream.private AbstractPullReader.EventreadEvent()private AbstractPullReader.EventreadRealEvent()voidreset()-
Methods inherited from class com.thoughtworks.xstream.io.xml.AbstractXmlReader
escapeXmlName, unescapeXmlName
-
Methods inherited from class com.thoughtworks.xstream.io.AbstractReader
decodeAttribute, decodeNode, encodeAttribute, encodeNode, underlyingReader
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.thoughtworks.xstream.io.HierarchicalStreamReader
appendErrors, close, getAttribute, getAttribute, getAttributeCount, getAttributeName
-
-
-
-
Field Detail
-
START_NODE
protected static final int START_NODE
- See Also:
- Constant Field Values
-
END_NODE
protected static final int END_NODE
- See Also:
- Constant Field Values
-
TEXT
protected static final int TEXT
- See Also:
- Constant Field Values
-
COMMENT
protected static final int COMMENT
- See Also:
- Constant Field Values
-
OTHER
protected static final int OTHER
- See Also:
- Constant Field Values
-
elementStack
private final FastStack elementStack
-
pool
private final FastStack pool
-
lookahead
private final FastStack lookahead
-
lookback
private final FastStack lookback
-
marked
private boolean marked
-
-
Constructor Detail
-
AbstractPullReader
protected AbstractPullReader(NameCoder nameCoder)
- Since:
- 1.4
-
AbstractPullReader
protected AbstractPullReader(XmlFriendlyReplacer replacer)
Deprecated.As of 1.4 useAbstractPullReader(NameCoder)instead- Since:
- 1.2
-
-
Method Detail
-
pullNextEvent
protected abstract int pullNextEvent()
Pull the next event from the stream.This MUST return
START_NODE,END_NODE,TEXT,COMMENT,OTHERor throwStreamException.The underlying pull parser will most likely return its own event types. These must be mapped to the appropriate events.
-
pullElementName
protected abstract java.lang.String pullElementName()
Pull the name of the current element from the stream.
-
pullText
protected abstract java.lang.String pullText()
Pull the contents of the current text node from the stream.
-
hasMoreChildren
public boolean hasMoreChildren()
Description copied from interface:HierarchicalStreamReaderDoes the node have any more children remaining that have not yet been read?
-
moveDown
public void moveDown()
Description copied from interface:HierarchicalStreamReaderSelect the current child as current node. A call to this function must be balanced with a call toHierarchicalStreamReader.moveUp().
-
moveUp
public void moveUp()
Description copied from interface:HierarchicalStreamReaderSelect the parent node as current node.
-
move
private void move()
-
readEvent
private AbstractPullReader.Event readEvent()
-
readRealEvent
private AbstractPullReader.Event readRealEvent()
-
mark
public void mark()
-
reset
public void reset()
-
getValue
public java.lang.String getValue()
Description copied from interface:HierarchicalStreamReaderGet the value (text content) of the current node.
-
getAttributeNames
public java.util.Iterator getAttributeNames()
Description copied from interface:HierarchicalStreamReaderIterator with the names of the attributes.Note, the iterator is only valid as long as the internal state of the underlying parser is still at the start of the current element. The behavior is undefined if the parser moved on.
-
getNodeName
public java.lang.String getNodeName()
Description copied from interface:HierarchicalStreamReaderGet the name of the current node.
-
peekNextChild
public java.lang.String peekNextChild()
Description copied from interface:ExtendedHierarchicalStreamReaderPeek the name of the next child. In situation whereHierarchicalStreamReader.hasMoreChildren()returns true, peek the tag name of the child.- Specified by:
peekNextChildin interfaceExtendedHierarchicalStreamReader- Overrides:
peekNextChildin classAbstractReader
-
-