View Javadoc

1   package yawn.io.serialization;
2   
3   import java.io.IOException;
4   import java.io.InputStreamReader;
5   import java.io.OutputStreamWriter;
6   
7   /***
8    * Abstract class for serializing objects.
9    * 
10   * <p>$Id: ISerializer.java,v 1.4 2005/04/20 18:55:04 supermarti Exp $</p>
11   * 
12   * @author <a href="mailto:alexei.guevara@uhn.on.ca">Alexei Guevara </a>
13   * @version $Revision: 1.4 $
14   */
15  public interface ISerializer {
16  
17      /***
18       * Serializes an object.
19       * 
20       * @param object
21       *            The object to serialize.
22       * @param writer
23       *            The destination where the serialized object will br writen to.
24       * @exception IOException
25       * @exception SerializationException
26       */
27      public void serialize(Object object, OutputStreamWriter writer) throws SerializationException;
28  
29      /***
30       * Reads an object of class <code>root</code> from a source
31       * 
32       * @param root
33       *            the object class to read
34       * @param reader
35       *            the source to read from
36       * @return the inflated object
37       * @throws SerializationException
38       * @throws IOException
39       */
40      public Object deSerialize(Class root, InputStreamReader reader) throws SerializationException;
41  }