Class BinaryStreamReader
- All Implemented Interfaces:
ErrorReporter, ExtendedHierarchicalStreamReader, HierarchicalStreamReader
BinaryStreamWriter.- Since:
- 1.2
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ReaderDepthStateprivate final BinaryStreamReader.IdRegistryprivate final DataInputStreamprivate Tokenprivate final Token.Formatter -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidappendErrors(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).voidclose()Close the reader, if necessary.getAttribute(int index) Get the value of an attribute of the current node, by index.getAttribute(String name) Get the value of an attribute of the current node.intNumber of attributes in current node.getAttributeName(int index) Name of attribute in current node.Iterator with the names of the attributes.Get the name of the current node.getValue()Get the value (text content) of the current node.booleanDoes the node have any more children remaining that have not yet been read?voidmoveDown()Select the current child as current node.voidmoveUp()Select the parent node as current node.Peek the name of the next child.voidprivate TokenReturn the underlying HierarchicalStreamReader implementation.
-
Field Details
-
in
-
depthState
-
idRegistry
-
pushback
-
tokenFormatter
-
-
Constructor Details
-
BinaryStreamReader
-
-
Method Details
-
hasMoreChildren
public boolean hasMoreChildren()Description copied from interface:HierarchicalStreamReaderDoes the node have any more children remaining that have not yet been read?- Specified by:
hasMoreChildrenin interfaceHierarchicalStreamReader
-
getNodeName
Description copied from interface:HierarchicalStreamReaderGet the name of the current node.- Specified by:
getNodeNamein interfaceHierarchicalStreamReader
-
getValue
Description copied from interface:HierarchicalStreamReaderGet the value (text content) of the current node.- Specified by:
getValuein interfaceHierarchicalStreamReader
-
getAttribute
Description copied from interface:HierarchicalStreamReaderGet the value of an attribute of the current node.If no such attribute exists, the method returns null.
- Specified by:
getAttributein interfaceHierarchicalStreamReader
-
getAttribute
Description copied from interface:HierarchicalStreamReaderGet the value of an attribute of the current node, by index.Note, the behavior of this method is dependent on the underlying parser when calling it with a non-existing index. Typically some kind of RuntimeException is thrown.
- Specified by:
getAttributein interfaceHierarchicalStreamReader
-
getAttributeCount
public int getAttributeCount()Description copied from interface:HierarchicalStreamReaderNumber of attributes in current node.- Specified by:
getAttributeCountin interfaceHierarchicalStreamReader
-
getAttributeName
Description copied from interface:HierarchicalStreamReaderName of attribute in current node.Note, the behavior of this method is dependent on the underlying parser when calling it with a non-existing index. Typically some kind of RuntimeException is thrown.
- Specified by:
getAttributeNamein interfaceHierarchicalStreamReader
-
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.
- Specified by:
getAttributeNamesin interfaceHierarchicalStreamReader
-
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().- Specified by:
moveDownin interfaceHierarchicalStreamReader
-
moveUp
public void moveUp()Description copied from interface:HierarchicalStreamReaderSelect the parent node as current node.- Specified by:
moveUpin interfaceHierarchicalStreamReader
-
readToken
-
pushBack
-
close
public void close()Description copied from interface:HierarchicalStreamReaderClose the reader, if necessary.- Specified by:
closein interfaceHierarchicalStreamReader
-
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
-
underlyingReader
Description copied from interface:HierarchicalStreamReaderReturn the underlying HierarchicalStreamReader implementation.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.
- Specified by:
underlyingReaderin interfaceHierarchicalStreamReader
-
appendErrors
Description copied from interface:HierarchicalStreamReaderIf any errors are detected, allow the reader to add any additional information that can aid debugging (such as line numbers, XPath expressions, etc).- Specified by:
appendErrorsin interfaceErrorReporter- Specified by:
appendErrorsin interfaceHierarchicalStreamReader- Parameters:
errorWriter- the error writer
-