Top Description Inners Fields Constructors Methods
com.thoughtworks.xstream.io.binary

public Class BinaryStreamReader

extends Object
implements ExtendedHierarchicalStreamReader
Class Inheritance
All Implemented Interfaces
com.thoughtworks.xstream.io.ExtendedHierarchicalStreamReader, com.thoughtworks.xstream.io.HierarchicalStreamReader, com.thoughtworks.xstream.converters.ErrorReporter
Imports
com.thoughtworks.xstream.converters.ErrorWriter, com.thoughtworks.xstream.io.ExtendedHierarchicalStreamReader, .HierarchicalStreamReader, .StreamException, java.io.DataInputStream, .IOException, .InputStream, java.util.HashMap, .Iterator, .Map

Deprecated

as a consequence of ExtendedHierarchicalStreamReader being deprecated. See corresponding docs for further information.

A HierarchicalStreamReader that reads from a binary stream created by BinaryStreamWriter.
Author
Joe Walnes
Since
1.2
See Also
BinaryStreamReader

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private final ReaderDepthState
private final BinaryStreamReader.IdRegistry
private final DataInputStream
private Token
private final Token.Formatter

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
appendErrors(ErrorWriter
the error writer
errorWriter
)

Implements com.thoughtworks.xstream.io.HierarchicalStreamReader.appendErrors.

If any errors are detected, allow the reader to add any additional information that can aid debugging (such as line numbers, XPath expressions, etc).
public void
close()

Implements com.thoughtworks.xstream.io.HierarchicalStreamReader.close.

Close the reader, if necessary.
public String
getAttribute(String name)

Implements com.thoughtworks.xstream.io.HierarchicalStreamReader.getAttribute.

Get the value of an attribute of the current node.
public String
getAttribute(int index)

Implements com.thoughtworks.xstream.io.HierarchicalStreamReader.getAttribute.

Get the value of an attribute of the current node, by index.
public int
public String
getAttributeName(int index)

Implements com.thoughtworks.xstream.io.HierarchicalStreamReader.getAttributeName.

Name of attribute in current node.
public Iterator<E>
getAttributeNames()

Implements com.thoughtworks.xstream.io.HierarchicalStreamReader.getAttributeNames.

Iterator with the names of the attributes.
public String
public String
getValue()

Implements com.thoughtworks.xstream.io.HierarchicalStreamReader.getValue.

Get the value (text content) of the current node.
public boolean
hasMoreChildren()

Implements com.thoughtworks.xstream.io.HierarchicalStreamReader.hasMoreChildren.

Does the node have any more children remaining that have not yet been read?
public void
moveDown()

Implements com.thoughtworks.xstream.io.HierarchicalStreamReader.moveDown.

Select the current child as current node.
public void
moveUp()

Implements com.thoughtworks.xstream.io.HierarchicalStreamReader.moveUp.

Select the parent node as current node.
public String
public void
pushBack(Token token)

private Token
public HierarchicalStreamReader
underlyingReader()

Implements com.thoughtworks.xstream.io.HierarchicalStreamReader.underlyingReader.

Return the underlying HierarchicalStreamReader implementation.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

depthStateback to summary
private final ReaderDepthState depthState
idRegistryback to summary
private final BinaryStreamReader.IdRegistry idRegistry
inback to summary
private final DataInputStream in
pushbackback to summary
private Token pushback
tokenFormatterback to summary
private final Token.Formatter tokenFormatter

Constructor Detail

BinaryStreamReaderback to summary
public BinaryStreamReader(InputStream inputStream)

Method Detail

appendErrorsback to summary
public void appendErrors(ErrorWriter errorWriter)

Implements com.thoughtworks.xstream.io.HierarchicalStreamReader.appendErrors.

Doc from com.thoughtworks.xstream.io.HierarchicalStreamReader.appendErrors.

If any errors are detected, allow the reader to add any additional information that can aid debugging (such as line numbers, XPath expressions, etc).

Parameters
errorWriter:ErrorWriter

Doc from com.thoughtworks.xstream.converters.ErrorReporter.appendErrors.

the error writer

closeback to summary
public void close()

Implements com.thoughtworks.xstream.io.HierarchicalStreamReader.close.

Doc from com.thoughtworks.xstream.io.HierarchicalStreamReader.close.

Close the reader, if necessary.

getAttributeback to summary
public String getAttribute(String name)

Implements com.thoughtworks.xstream.io.HierarchicalStreamReader.getAttribute.

Doc from com.thoughtworks.xstream.io.HierarchicalStreamReader.getAttribute.

Get the value of an attribute of the current node.

If no such attribute exists, the method returns null.

getAttributeback to summary
public String getAttribute(int index)

Implements com.thoughtworks.xstream.io.HierarchicalStreamReader.getAttribute.

Doc from com.thoughtworks.xstream.io.HierarchicalStreamReader.getAttribute.

Get 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.

getAttributeCountback to summary
public int getAttributeCount()

Implements com.thoughtworks.xstream.io.HierarchicalStreamReader.getAttributeCount.

Doc from com.thoughtworks.xstream.io.HierarchicalStreamReader.getAttributeCount.

Number of attributes in current node.

getAttributeNameback to summary
public String getAttributeName(int index)

Implements com.thoughtworks.xstream.io.HierarchicalStreamReader.getAttributeName.

Doc from com.thoughtworks.xstream.io.HierarchicalStreamReader.getAttributeName.

Name 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.

getAttributeNamesback to summary
public Iterator<E> getAttributeNames()

Implements com.thoughtworks.xstream.io.HierarchicalStreamReader.getAttributeNames.

Doc from com.thoughtworks.xstream.io.HierarchicalStreamReader.getAttributeNames.

Iterator 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.

getNodeNameback to summary
public String getNodeName()

Implements com.thoughtworks.xstream.io.HierarchicalStreamReader.getNodeName.

Doc from com.thoughtworks.xstream.io.HierarchicalStreamReader.getNodeName.

Get the name of the current node.

getValueback to summary
public String getValue()

Implements com.thoughtworks.xstream.io.HierarchicalStreamReader.getValue.

Doc from com.thoughtworks.xstream.io.HierarchicalStreamReader.getValue.

Get the value (text content) of the current node.

hasMoreChildrenback to summary
public boolean hasMoreChildren()

Implements com.thoughtworks.xstream.io.HierarchicalStreamReader.hasMoreChildren.

Doc from com.thoughtworks.xstream.io.HierarchicalStreamReader.hasMoreChildren.

Does the node have any more children remaining that have not yet been read?

moveDownback to summary
public void moveDown()

Implements com.thoughtworks.xstream.io.HierarchicalStreamReader.moveDown.

Doc from com.thoughtworks.xstream.io.HierarchicalStreamReader.moveDown.

Select the current child as current node. A call to this function must be balanced with a call to moveUp().

moveUpback to summary
public void moveUp()

Implements com.thoughtworks.xstream.io.HierarchicalStreamReader.moveUp.

Doc from com.thoughtworks.xstream.io.HierarchicalStreamReader.moveUp.

Select the parent node as current node.

peekNextChildback to summary
public String peekNextChild()

Implements com.thoughtworks.xstream.io.ExtendedHierarchicalStreamReader.peekNextChild.

Doc from com.thoughtworks.xstream.io.ExtendedHierarchicalStreamReader.peekNextChild.

Peek the name of the next child. In situation where hasMoreChildren() returns true, peek the tag name of the child.

pushBackback to summary
public void pushBack(Token token)
readTokenback to summary
private Token readToken()
underlyingReaderback to summary
public HierarchicalStreamReader underlyingReader()

Implements com.thoughtworks.xstream.io.HierarchicalStreamReader.underlyingReader.

Doc from com.thoughtworks.xstream.io.HierarchicalStreamReader.underlyingReader.

Return 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.

com.thoughtworks.xstream.io.binary back to summary

private Class BinaryStreamReader.IdRegistry

extends Object
Class Inheritance
  • java.lang.Object
  • com.thoughtworks.xstream.io.binary.BinaryStreamReader.IdRegistry

Field Summary

Modifier and TypeField and Description
private Map<K, V>

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public String
get(long id)

public void
put(long id, String value)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

mapback to summary
private Map<K, V> map

Constructor Detail

IdRegistryback to summary
private IdRegistry()

Method Detail

getback to summary
public String get(long id)
putback to summary
public void put(long id, String value)