public class SerialUtils extends Object
Modifier and Type | Method and Description |
---|---|
static boolean |
isSerializable(Class c)
Returns
true if a class implements Serializable
and false otherwise. |
static AttributedString |
readAttributedString(ObjectInputStream stream)
Reads a
AttributedString object that has been serialised by
the writeAttributedString(AttributedString,
ObjectOutputStream) method. |
static Composite |
readComposite(ObjectInputStream stream)
Reads a
Composite object that has been serialised by the
writeComposite(Composite, ObjectOutputStream)
method. |
static Paint |
readPaint(ObjectInputStream stream)
Reads a
Paint object that has been serialised by the
writePaint(Paint, ObjectOutputStream) method. |
static Point2D |
readPoint2D(ObjectInputStream stream)
Reads a
Point2D object that has been serialised by the
writePoint2D(Point2D, ObjectOutputStream) method. |
static Shape |
readShape(ObjectInputStream stream)
Reads a
Shape object that has been serialised by the
writeShape(Shape, ObjectOutputStream) method. |
static Stroke |
readStroke(ObjectInputStream stream)
Reads a
Stroke object that has been serialised by the
writeStroke(Stroke, ObjectOutputStream) method. |
static void |
writeAttributedString(AttributedString as,
ObjectOutputStream stream)
Serialises an
AttributedString object. |
static void |
writeComposite(Composite composite,
ObjectOutputStream stream)
Serialises a
Composite object. |
static void |
writePaint(Paint paint,
ObjectOutputStream stream)
Serialises a
Paint object. |
static void |
writePoint2D(Point2D p,
ObjectOutputStream stream)
Serialises a
Point2D object. |
static void |
writeShape(Shape shape,
ObjectOutputStream stream)
Serialises a
Shape object. |
static void |
writeStroke(Stroke stroke,
ObjectOutputStream stream)
Serialises a
Stroke object. |
public static boolean isSerializable(Class c)
true
if a class implements Serializable
and false
otherwise.c
- the class.public static Paint readPaint(ObjectInputStream stream) throws IOException, ClassNotFoundException
Paint
object that has been serialised by the
writePaint(Paint, ObjectOutputStream)
method.stream
- the input stream (null
not permitted).null
).IOException
- if there is an I/O problem.ClassNotFoundException
- if there is a problem loading a class.public static void writePaint(Paint paint, ObjectOutputStream stream) throws IOException
Paint
object.paint
- the paint object (null
permitted).stream
- the output stream (null
not permitted).IOException
- if there is an I/O error.public static Stroke readStroke(ObjectInputStream stream) throws IOException, ClassNotFoundException
Stroke
object that has been serialised by the
writeStroke(Stroke, ObjectOutputStream)
method.stream
- the input stream (null
not permitted).null
).IOException
- if there is an I/O problem.ClassNotFoundException
- if there is a problem loading a class.public static void writeStroke(Stroke stroke, ObjectOutputStream stream) throws IOException
Stroke
object. This code handles the
BasicStroke
class which is the only Stroke
implementation provided by the JDK (and isn't directly
Serializable
).stroke
- the stroke object (null
permitted).stream
- the output stream (null
not permitted).IOException
- if there is an I/O error.public static Composite readComposite(ObjectInputStream stream) throws IOException, ClassNotFoundException
Composite
object that has been serialised by the
writeComposite(Composite, ObjectOutputStream)
method.stream
- the input stream (null
not permitted).null
).IOException
- if there is an I/O problem.ClassNotFoundException
- if there is a problem loading a class.public static void writeComposite(Composite composite, ObjectOutputStream stream) throws IOException
Composite
object.composite
- the composite object (null
permitted).stream
- the output stream (null
not permitted).IOException
- if there is an I/O error.public static Shape readShape(ObjectInputStream stream) throws IOException, ClassNotFoundException
Shape
object that has been serialised by the
writeShape(Shape, ObjectOutputStream)
method.stream
- the input stream (null
not permitted).null
).IOException
- if there is an I/O problem.ClassNotFoundException
- if there is a problem loading a class.public static void writeShape(Shape shape, ObjectOutputStream stream) throws IOException
Shape
object.shape
- the shape object (null
permitted).stream
- the output stream (null
not permitted).IOException
- if there is an I/O error.public static Point2D readPoint2D(ObjectInputStream stream) throws IOException
Point2D
object that has been serialised by the
writePoint2D(Point2D, ObjectOutputStream)
method.stream
- the input stream (null
not permitted).null
).IOException
- if there is an I/O problem.public static void writePoint2D(Point2D p, ObjectOutputStream stream) throws IOException
Point2D
object.p
- the point object (null
permitted).stream
- the output stream (null
not permitted).IOException
- if there is an I/O error.public static AttributedString readAttributedString(ObjectInputStream stream) throws IOException, ClassNotFoundException
AttributedString
object that has been serialised by
the writeAttributedString(AttributedString,
ObjectOutputStream)
method.stream
- the input stream (null
not permitted).null
).IOException
- if there is an I/O problem.ClassNotFoundException
- if there is a problem loading a class.public static void writeAttributedString(AttributedString as, ObjectOutputStream stream) throws IOException
AttributedString
object.as
- the attributed string object (null
permitted).stream
- the output stream (null
not permitted).IOException
- if there is an I/O error.Copyright © 2001–2017 JFree.org. All rights reserved.