Source for org.jfree.serializer.SerializeMethod

   1: /**
   2:  * ===================================================
   3:  * JCommon-Serializer : a free serialization framework
   4:  * ===================================================
   5:  *
   6:  * Project Info:  http://www.jfree.org/jfreereport/jcommon-serializer/
   7:  * Project Lead:  Thomas Morgner;
   8:  *
   9:  * (C) Copyright 2006, by Object Refinery Limited and Pentaho Corporation.
  10:  *
  11:  * This library is free software; you can redistribute it and/or modify it under the terms
  12:  * of the GNU Lesser General Public License as published by the Free Software Foundation;
  13:  * either version 2.1 of the License, or (at your option) any later version.
  14:  *
  15:  * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
  16:  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  17:  * See the GNU Lesser General Public License for more details.
  18:  *
  19:  * You should have received a copy of the GNU Lesser General Public License along with this
  20:  * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
  21:  * Boston, MA 02111-1307, USA.
  22:  *
  23:  * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
  24:  * in the United States and other countries.]
  25:  *
  26:  * ------------
  27:  * SerializeMethod.java
  28:  * ------------
  29:  * (C) Copyright 2006, by Object Refinery Limited and Pentaho Corporation.
  30:  *
  31:  * Original Author:  Thomas Morgner;
  32:  * Contributor(s):   -;
  33:  *
  34:  * $Id: SerializeMethod.java,v 1.2 2006/04/17 16:03:24 taqua Exp $
  35:  *
  36:  * Changes
  37:  * -------
  38:  *
  39:  *
  40:  */
  41: 
  42: package org.jfree.serializer;
  43: 
  44: import java.io.IOException;
  45: import java.io.ObjectInputStream;
  46: import java.io.ObjectOutputStream;
  47: 
  48: /**
  49:  * The SerializeMethod is used to define a serialization strategy for a certain object
  50:  * type.
  51:  *
  52:  * @author Thomas Morgner
  53:  */
  54: public interface SerializeMethod
  55: {
  56:   /**
  57:    * Writes a serializable object description to the given object output stream.
  58:    *
  59:    * @param o   the to be serialized object.
  60:    * @param out the outputstream that should receive the object.
  61:    * @throws IOException if an I/O error occured.
  62:    */
  63:   public void writeObject (Object o, ObjectOutputStream out)
  64:           throws IOException;
  65: 
  66:   /**
  67:    * Reads the object from the object input stream.
  68:    *
  69:    * @param in the object input stream from where to read the serialized data.
  70:    * @return the generated object.
  71:    *
  72:    * @throws IOException            if reading the stream failed.
  73:    * @throws ClassNotFoundException if serialized object class cannot be found.
  74:    */
  75:   public Object readObject (ObjectInputStream in)
  76:           throws IOException, ClassNotFoundException;
  77: 
  78:   /**
  79:    * The class of the object, which this object can serialize.
  80:    *
  81:    * @return the class of the object type, which this method handles.
  82:    */
  83:   public Class getObjectClass ();
  84: }