public class BinaryStreamReader extends Object implements ExtendedHierarchicalStreamReader
BinaryStreamWriter
.BinaryStreamReader
Constructor and Description |
---|
BinaryStreamReader(InputStream inputStream) |
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.
|
String |
peekNextChild()
Peek the name of the next child.
|
void |
pushBack(Token token) |
HierarchicalStreamReader |
underlyingReader()
Return the underlying HierarchicalStreamReader implementation.
|
public BinaryStreamReader(InputStream inputStream)
public boolean hasMoreChildren()
HierarchicalStreamReader
hasMoreChildren
in interface HierarchicalStreamReader
public String getNodeName()
HierarchicalStreamReader
getNodeName
in interface HierarchicalStreamReader
public String getValue()
HierarchicalStreamReader
getValue
in interface HierarchicalStreamReader
public String getAttribute(String name)
HierarchicalStreamReader
getAttribute
in interface HierarchicalStreamReader
public String getAttribute(int index)
HierarchicalStreamReader
getAttribute
in interface HierarchicalStreamReader
public int getAttributeCount()
HierarchicalStreamReader
getAttributeCount
in interface HierarchicalStreamReader
public String getAttributeName(int index)
HierarchicalStreamReader
getAttributeName
in interface HierarchicalStreamReader
public Iterator getAttributeNames()
HierarchicalStreamReader
getAttributeNames
in interface HierarchicalStreamReader
public void moveDown()
HierarchicalStreamReader
HierarchicalStreamReader.moveUp()
.moveDown
in interface HierarchicalStreamReader
public void moveUp()
HierarchicalStreamReader
moveUp
in interface HierarchicalStreamReader
public void pushBack(Token token)
public void close()
HierarchicalStreamReader
close
in interface HierarchicalStreamReader
public String peekNextChild()
ExtendedHierarchicalStreamReader
HierarchicalStreamReader.hasMoreChildren()
returns
true, peek the tag name of the child.peekNextChild
in interface ExtendedHierarchicalStreamReader
public HierarchicalStreamReader underlyingReader()
HierarchicalStreamReader
If 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 HierarchicalStreamReader
public void appendErrors(ErrorWriter errorWriter)
HierarchicalStreamReader
appendErrors
in interface ErrorReporter
appendErrors
in interface HierarchicalStreamReader
errorWriter
- the error writerCopyright © 2004–2016 XStream. All rights reserved.