gui
Class GuiSerializer

java.lang.Object
  |
  +--gui.GuiSerializer

public class GuiSerializer
extends java.lang.Object

The class GuiSerializer provide methods to serialize and deserialize components.

Version:
99/07/10
Author:
Martin Lippert

Constructor Summary
private GuiSerializer()
           
 
Method Summary
static java.awt.Component read(java.io.InputStream istream)
          Reads a component from an input stream and deserializes it.
static java.awt.Component read(java.lang.String pathname)
          Reads a component from a file and deserializes it.
static void write(java.io.OutputStream ostream, java.awt.Component component)
          Serializes a component and writes it to the output stream.
static void write(java.lang.String pathname, java.awt.Component component)
          Serializes a component and writes it to a file.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Constructor Detail

GuiSerializer

private GuiSerializer()
Method Detail

write

public static void write(java.io.OutputStream ostream,
                         java.awt.Component component)
                  throws java.io.IOException
Serializes a component and writes it to the output stream.
Parameters:
ostream - the stream to which the component is written
component - the component to be serialized
Throws:
java.io.IOException - when serialization fails

write

public static void write(java.lang.String pathname,
                         java.awt.Component component)
                  throws java.io.IOException
Serializes a component and writes it to a file.
Parameters:
pathname - the name of the file to which the component is written
component - the component to be serialized
Throws:
java.io.IOException - when serialization fails

read

public static java.awt.Component read(java.io.InputStream istream)
                               throws java.io.IOException,
                                      java.io.StreamCorruptedException,
                                      java.lang.ClassNotFoundException,
                                      java.io.OptionalDataException
Reads a component from an input stream and deserializes it.
Parameters:
istream - the input stream from where the component is read
Returns:
the deserialized component
Throws:
java.io.IOException - when deserialization fails
java.io.StreamCorruptedException - when deserialization fails
java.lang.ClassNotFoundException - when the deserialized class can't be loaded
java.io.OptionalDataException - when deserialization fails

read

public static java.awt.Component read(java.lang.String pathname)
                               throws java.io.FileNotFoundException,
                                      java.io.IOException,
                                      java.lang.ClassNotFoundException
Reads a component from a file and deserializes it.
Parameters:
pathname - the name of the file from which the component is read
Returns:
the deserialized component
Throws:
java.io.IOException - when deserialization fails
java.io.StreamCorruptedException - when deserialization fails
java.lang.ClassNotFoundException - when the deserialized class can't be loaded
java.io.OptionalDataException - when deserialization fails