org.eclipse.core.internal.watson
Class ElementTreeReader

java.lang.Object
  extended by org.eclipse.core.internal.watson.ElementTreeReader

public class ElementTreeReader
extends java.lang.Object

ElementTreeReader is the standard implementation of an element tree serialization reader.

Subclasses of this reader read can handle current and various known old formats of a saved element tree, and dispatch internally to an appropriate reader.

The reader has an IElementInfoFactory, which it consults for the schema and for creating and reading element infos.

Element tree readers are thread-safe; several threads may share a single reader provided, of course, that the IElementInfoFactory is thread-safe.


Constructor Summary
ElementTreeReader(IElementInfoFlattener factory)
          Constructs a new element tree reader that works for the given element info flattener.
 
Method Summary
 ElementTreeReader getReader(int formatVersion)
          Returns the appropriate reader for the given version.
 ElementTree readDelta(ElementTree completeTree, java.io.DataInput input)
          Reads an element tree delta from the input stream, and reconstructs it as a delta on the given tree.
 ElementTree[] readDeltaChain(java.io.DataInput input)
          Reads a chain of ElementTrees from the given input stream.
 ElementTree readTree(java.io.DataInput input)
          Reads an element tree from the input stream and returns it.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ElementTreeReader

public ElementTreeReader(IElementInfoFlattener factory)
Constructs a new element tree reader that works for the given element info flattener.

Method Detail

getReader

public ElementTreeReader getReader(int formatVersion)
                            throws java.io.IOException
Returns the appropriate reader for the given version.

Throws:
java.io.IOException

readDelta

public ElementTree readDelta(ElementTree completeTree,
                             java.io.DataInput input)
                      throws java.io.IOException
Reads an element tree delta from the input stream, and reconstructs it as a delta on the given tree.

Throws:
java.io.IOException

readDeltaChain

public ElementTree[] readDeltaChain(java.io.DataInput input)
                             throws java.io.IOException
Reads a chain of ElementTrees from the given input stream.

Returns:
A chain of ElementTrees, where the first tree in the list is complete, and all other trees are deltas on the previous tree in the list.
Throws:
java.io.IOException

readTree

public ElementTree readTree(java.io.DataInput input)
                     throws java.io.IOException
Reads an element tree from the input stream and returns it. This method actually just dispatches to the appropriate reader depending on the stream version id.

Throws:
java.io.IOException