public abstract class ReaderWrapper extends Object implements HierarchicalStreamReader
| Modifier and Type | Field and Description |
|---|---|
protected HierarchicalStreamReader |
wrapped |
| Modifier | Constructor and Description |
|---|---|
protected |
ReaderWrapper(HierarchicalStreamReader reader) |
| Modifier and Type | Method and Description |
|---|---|
void |
appendErrors(ErrorWriter errorWriter)
If any errors are detected, allow the reader to add any additional information that can aid debugging
(such as line numbers, XPath expressions, etc).
|
void |
close()
Close the reader, if necessary.
|
String |
getAttribute(int index)
Get the value of an attribute of the current node, by index.
|
String |
getAttribute(String name)
Get the value of an attribute of the current node.
|
int |
getAttributeCount()
Number of attributes in current node.
|
String |
getAttributeName(int index)
Name of attribute in current node.
|
Iterator |
getAttributeNames()
Names of attributes (as Strings).
|
String |
getNodeName()
Get the name of the current node.
|
String |
getValue()
Get the value (text content) of the current node.
|
boolean |
hasMoreChildren()
Does the node have any more children remaining that have not yet been read?
|
void |
moveDown()
Select the current child as current node.
|
void |
moveUp()
Select the parent node as current node.
|
HierarchicalStreamReader |
underlyingReader()
Return the underlying HierarchicalStreamReader implementation.
|
protected HierarchicalStreamReader wrapped
protected ReaderWrapper(HierarchicalStreamReader reader)
public boolean hasMoreChildren()
HierarchicalStreamReaderhasMoreChildren in interface HierarchicalStreamReaderpublic void moveDown()
HierarchicalStreamReaderHierarchicalStreamReader.moveUp().moveDown in interface HierarchicalStreamReaderpublic void moveUp()
HierarchicalStreamReadermoveUp in interface HierarchicalStreamReaderpublic String getNodeName()
HierarchicalStreamReadergetNodeName in interface HierarchicalStreamReaderpublic String getValue()
HierarchicalStreamReadergetValue in interface HierarchicalStreamReaderpublic String getAttribute(String name)
HierarchicalStreamReadergetAttribute in interface HierarchicalStreamReaderpublic String getAttribute(int index)
HierarchicalStreamReadergetAttribute in interface HierarchicalStreamReaderpublic int getAttributeCount()
HierarchicalStreamReadergetAttributeCount in interface HierarchicalStreamReaderpublic String getAttributeName(int index)
HierarchicalStreamReadergetAttributeName in interface HierarchicalStreamReaderpublic Iterator getAttributeNames()
HierarchicalStreamReadergetAttributeNames in interface HierarchicalStreamReaderpublic void appendErrors(ErrorWriter errorWriter)
HierarchicalStreamReaderappendErrors in interface HierarchicalStreamReaderpublic void close()
HierarchicalStreamReaderclose in interface HierarchicalStreamReaderpublic HierarchicalStreamReader underlyingReader()
HierarchicalStreamReaderIf a Converter needs to access methods of a specific HierarchicalStreamReader implementation that are not defined in the HierarchicalStreamReader interface, it should call this method before casting. This is because the reader passed to the Converter is often wrapped/decorated by another implementation to provide additional functionality (such as XPath tracking).
For example:
MySpecificReader mySpecificReader = (MySpecificReader)reader; // INCORRECT! mySpecificReader.doSomethingSpecific();
MySpecificReader mySpecificReader = (MySpecificReader)reader.underlyingReader(); // CORRECT! mySpecificReader.doSomethingSpecific();
Implementations of HierarchicalStreamReader should return 'this', unless they are a decorator, in which case they should delegate to whatever they are wrapping.
underlyingReader in interface HierarchicalStreamReaderCopyright © 2020 Internet2. All rights reserved.