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

public abstract Class AbstractReader

extends Object
implements ExtendedHierarchicalStreamReader
Class Inheritance
All Implemented Interfaces
com.thoughtworks.xstream.io.ExtendedHierarchicalStreamReader, com.thoughtworks.xstream.io.HierarchicalStreamReader, com.thoughtworks.xstream.converters.ErrorReporter
Known Direct Subclasses
com.thoughtworks.xstream.io.xml.AbstractXmlReader
Imports
com.thoughtworks.xstream.core.util.Cloneables, com.thoughtworks.xstream.io.naming.NameCoder, .NoNameCoder

Deprecated

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

Abstract base class for all HierarchicalStreamReader implementations. Implementations of HierarchicalStreamReader should rather be derived from this class then implementing the interface directly.
Author
Jörg Schaible
Since
1.4

Field Summary

Modifier and TypeField and Description
private NameCoder

Constructor Summary

AccessConstructor and Description
protected
AbstractReader()

Creates an AbstractReader with a NameCoder that does nothing.

protected
AbstractReader(NameCoder
the name coder used to read names from the incoming format
nameCoder
)

Creates an AbstractReader with a provided NameCoder.

Method Summary

Modifier and TypeMethod and Description
public String

Returns:

the original name
decodeAttribute
(String
the name in the target format
name
)

Decode an attribute name from the target format.

public String

Returns:

the original name
decodeNode
(String
the name in the target format
name
)

Decode a node name from the target format.

protected String

Returns:

the name in the target format
encodeAttribute
(String
the original name
name
)

Encode the attribute name again into the name of the target format.

protected String

Returns:

the name in the target format
encodeNode
(String
the original name
name
)

Encode the node name again into the name of the target format.

public String
public HierarchicalStreamReader
underlyingReader()

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

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

Field Detail

nameCoderback to summary
private NameCoder nameCoder

Constructor Detail

AbstractReaderback to summary
protected AbstractReader()

Creates an AbstractReader with a NameCoder that does nothing.

Since
1.4
AbstractReaderback to summary
protected AbstractReader(NameCoder nameCoder)

Creates an AbstractReader with a provided NameCoder.

Parameters
nameCoder:NameCoder

the name coder used to read names from the incoming format

Since
1.4

Method Detail

decodeAttributeback to summary
public String decodeAttribute(String name)

Decode an attribute name from the target format.

Parameters
name:String

the name in the target format

Returns:String

the original name

Since
1.4
decodeNodeback to summary
public String decodeNode(String name)

Decode a node name from the target format.

Parameters
name:String

the name in the target format

Returns:String

the original name

Since
1.4
encodeAttributeback to summary
protected String encodeAttribute(String name)

Encode the attribute name again into the name of the target format. Internally used.

Parameters
name:String

the original name

Returns:String

the name in the target format

Since
1.4
encodeNodeback to summary
protected String encodeNode(String name)

Encode the node name again into the name of the target format. Internally used.

Parameters
name:String

the original name

Returns:String

the name in the target format

Since
1.4
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.

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.