J avolution v3.7 (J2SE 1.5+)

javolution.xml
Class ObjectReader<T>

java.lang.Object
  extended by javolution.xml.ObjectReader<T>
All Implemented Interfaces:
Reusable

public class ObjectReader<T>
extends java.lang.Object
implements Reusable

This class restores objects which have been serialized in XML format using an ObjectWriter.

When the XML document is parsed, each elements are recursively processed and Java objects are created using the XmlFormat of the class identified by the name of the XML element. The final object constructed (and returned) is always the root element of the XML input source.

Non-blank character data of the XML document are represented by CharacterData instances.

Version:
3.6, October 13, 2005
Author:
Jean-Marie Dautelle

Constructor Summary
ObjectReader()
          Default constructor.
 
Method Summary
 T read(java.nio.ByteBuffer byteBuffer)
          Creates an object from its XML representation read from the specified ByteBuffer.
 T read(java.io.InputStream in)
          Creates an object from its XML representation read from the specified InputStream.
 T read(java.io.Reader reader)
          Creates an object from its XML representation read from the specified Reader.
 void reset()
          Resets this object reader; objects previously read cannot be refered to, they will have to be send again.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjectReader

public ObjectReader()
Default constructor.

Method Detail

read

public T read(java.io.Reader reader)
       throws XmlException
Creates an object from its XML representation read from the specified Reader. This method reads until the end of stream; to read multiple objects over a persistent connection XmlInputStream should be used instead.

Parameters:
reader - the reader containing the XML representation of the object being created.
Returns:
the object corresponding to the xml root element.
Throws:
XmlException - if the object cannot be created.

read

public T read(java.io.InputStream in)
       throws XmlException
Creates an object from its XML representation read from the specified InputStream. This method reads until the end of stream; to read multiple objects over a persistent connection XmlInputStream should be used instead.

Parameters:
in - the input stream containing the XML representation of the object being created.
Returns:
the object corresponding to the xml root element.
Throws:
XmlException - if the object cannot be created.

read

public T read(java.nio.ByteBuffer byteBuffer)
       throws XmlException
Creates an object from its XML representation read from the specified ByteBuffer. This method reads from the current buffer position up to the buffer's limit.

Parameters:
byteBuffer - the byte buffer containing the XML representation of the object being created.
Returns:
the object corresponding to the xml root element.
Throws:
XmlException - if the object cannot be created.

reset

public void reset()
Resets this object reader; objects previously read cannot be refered to, they will have to be send again.

Specified by:
reset in interface Reusable

J avolution v3.7 (J2SE 1.5+)

Copyright © 2006 Javolution.