home *** CD-ROM | disk | FTP | other *** search
/ The Net: Ultimate Internet Guide / WWLCD1.ISO / pc / java / in4wjcxu / src / como / io / saveable.java < prev    next >
Encoding:
Java Source  |  1996-08-14  |  929 b   |  38 lines

  1. /**
  2.  *
  3.  * Saveable.java     (c) 1996 Ulrich Gall & Jan Kautz
  4.  *
  5.  */
  6.  
  7. package como.io;
  8.  
  9. import java.io.IOException;
  10. import como.io.*;
  11.  
  12. /**
  13.  * Objects that may be saved/loaded from/to disk/network
  14.  * should implement this interface. Then they can be
  15.  * converted using the ObjectXXXStream!
  16.  *
  17.  */
  18. public interface Saveable {
  19.     /**
  20.      * This method is called when the Object is loaded!
  21.      * It gets instantiated and then load(i) will be called.
  22.      * @param i ObjectInputStream from where you can read
  23.      *  your saved data.
  24.      */
  25.     public void load(ObjectInputStream i) throws IOException;
  26.  
  27.     /**
  28.      * This method is called when the Object is saved!
  29.      * save(o) will be called. You have to write any
  30.      * necessary data to it (which will be loaded afterwards
  31.      * by load() from an ObjectInputStream).
  32.      * @param o ObjectOutputStream where you have to write
  33.      *  your data.
  34.      */
  35.     public void save(ObjectOutputStream o) throws IOException;
  36. }
  37.     
  38.