org.jfree.io
Class SerialUtilities

java.lang.Object
  extended byorg.jfree.io.SerialUtilities

public abstract class SerialUtilities
extends java.lang.Object

A class containing useful utility methods relating to serialization.


Constructor Summary
SerialUtilities()
           
 
Method Summary
static boolean isSerializable(java.lang.Class c)
          Returns true if a class implements Serializable and false otherwise.
static java.awt.Paint readPaint(java.io.ObjectInputStream stream)
          Reads a Paint object that has been serialised by the writePaint(Paint, ObjectOutputStream) method.
static java.awt.geom.Point2D readPoint2D(java.io.ObjectInputStream stream)
          Reads a Point2D object that has been serialised by the writePoint2D(Point2D, ObjectOutputStream) method.
static java.awt.Shape readShape(java.io.ObjectInputStream stream)
          Reads a Shape object that has been serialised by the writeShape(Shape, ObjectOutputStream) method.
static java.awt.Stroke readStroke(java.io.ObjectInputStream stream)
          Reads a Stroke object that has been serialised by the writeStroke(Stroke, ObjectOutputStream) method.
static void writePaint(java.awt.Paint paint, java.io.ObjectOutputStream stream)
          Serialises a Paint object.
static void writePoint2D(java.awt.geom.Point2D p, java.io.ObjectOutputStream stream)
          Serialises a Shape object.
static void writeShape(java.awt.Shape shape, java.io.ObjectOutputStream stream)
          Serialises a Shape object.
static void writeStroke(java.awt.Stroke stroke, java.io.ObjectOutputStream stream)
          Serialises a Stroke object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SerialUtilities

public SerialUtilities()
Method Detail

isSerializable

public static boolean isSerializable(java.lang.Class c)
Returns true if a class implements Serializable and false otherwise.

Parameters:
c - the class.
Returns:
A boolean.

readPaint

public static java.awt.Paint readPaint(java.io.ObjectInputStream stream)
                                throws java.io.IOException,
                                       java.lang.ClassNotFoundException
Reads a Paint object that has been serialised by the writePaint(Paint, ObjectOutputStream) method.

Parameters:
stream - the input stream (null not permitted).
Returns:
The paint object (possibly null).
Throws:
java.io.IOException - if there is an I/O problem.
java.lang.ClassNotFoundException - if there is a problem loading a class.

writePaint

public static void writePaint(java.awt.Paint paint,
                              java.io.ObjectOutputStream stream)
                       throws java.io.IOException
Serialises a Paint object.

Parameters:
paint - the paint object (null permitted).
stream - the output stream (null not permitted).
Throws:
java.io.IOException - if there is an I/O error.

readStroke

public static java.awt.Stroke readStroke(java.io.ObjectInputStream stream)
                                  throws java.io.IOException,
                                         java.lang.ClassNotFoundException
Reads a Stroke object that has been serialised by the writeStroke(Stroke, ObjectOutputStream) method.

Parameters:
stream - the input stream (null not permitted).
Returns:
The stroke object (possibly null).
Throws:
java.io.IOException - if there is an I/O problem.
java.lang.ClassNotFoundException - if there is a problem loading a class.

writeStroke

public static void writeStroke(java.awt.Stroke stroke,
                               java.io.ObjectOutputStream stream)
                        throws java.io.IOException
Serialises a Stroke object.

Parameters:
stroke - the stroke object (null permitted).
stream - the output stream (null not permitted).
Throws:
java.io.IOException - if there is an I/O error.

readShape

public static java.awt.Shape readShape(java.io.ObjectInputStream stream)
                                throws java.io.IOException,
                                       java.lang.ClassNotFoundException
Reads a Shape object that has been serialised by the writeShape(Shape, ObjectOutputStream) method.

Parameters:
stream - the input stream (null not permitted).
Returns:
The shape object (possibly null).
Throws:
java.io.IOException - if there is an I/O problem.
java.lang.ClassNotFoundException - if there is a problem loading a class.

writeShape

public static void writeShape(java.awt.Shape shape,
                              java.io.ObjectOutputStream stream)
                       throws java.io.IOException
Serialises a Shape object.

Parameters:
shape - the shape object (null permitted).
stream - the output stream (null not permitted).
Throws:
java.io.IOException - if there is an I/O error.

readPoint2D

public static java.awt.geom.Point2D readPoint2D(java.io.ObjectInputStream stream)
                                         throws java.io.IOException,
                                                java.lang.ClassNotFoundException
Reads a Point2D object that has been serialised by the writePoint2D(Point2D, ObjectOutputStream) method.

Parameters:
stream - the input stream (null not permitted).
Returns:
The point object (possibly null).
Throws:
java.io.IOException - if there is an I/O problem.
java.lang.ClassNotFoundException - if there is a problem loading a class.

writePoint2D

public static void writePoint2D(java.awt.geom.Point2D p,
                                java.io.ObjectOutputStream stream)
                         throws java.io.IOException
Serialises a Shape object.

Parameters:
p - the point object (null permitted).
stream - the output stream (null not permitted).
Throws:
java.io.IOException - if there is an I/O error.