Package org.jfree.chart.util
Class SerialUtils
java.lang.Object
org.jfree.chart.util.SerialUtils
A class containing useful utility methods relating to serialization.
- 
Method SummaryModifier and TypeMethodDescriptionstatic booleanReturnstrueif a class implementsSerializableandfalseotherwise.static AttributedStringReads aAttributedStringobject that has been serialised by thewriteAttributedString(AttributedString, ObjectOutputStream)method.static CompositereadComposite(ObjectInputStream stream) Reads aCompositeobject that has been serialised by thewriteComposite(Composite, ObjectOutputStream)method.static PaintreadPaint(ObjectInputStream stream) Reads aPaintobject that has been serialised by thewritePaint(Paint, ObjectOutputStream)method.static Point2DreadPoint2D(ObjectInputStream stream) Reads aPoint2Dobject that has been serialised by thewritePoint2D(Point2D, ObjectOutputStream)method.static ShapereadShape(ObjectInputStream stream) Reads aShapeobject that has been serialised by thewriteShape(Shape, ObjectOutputStream)method.static StrokereadStroke(ObjectInputStream stream) Reads aStrokeobject that has been serialised by thewriteStroke(Stroke, ObjectOutputStream)method.static voidwriteAttributedString(AttributedString as, ObjectOutputStream stream) Serialises anAttributedStringobject.static voidwriteComposite(Composite composite, ObjectOutputStream stream) Serialises aCompositeobject.static voidwritePaint(Paint paint, ObjectOutputStream stream) Serialises aPaintobject.static voidwritePoint2D(Point2D p, ObjectOutputStream stream) Serialises aPoint2Dobject.static voidwriteShape(Shape shape, ObjectOutputStream stream) Serialises aShapeobject.static voidwriteStroke(Stroke stroke, ObjectOutputStream stream) Serialises aStrokeobject.
- 
Method Details- 
isSerializableReturnstrueif a class implementsSerializableandfalseotherwise.- Parameters:
- c- the class.
- Returns:
- A boolean.
 
- 
readPaintReads aPaintobject that has been serialised by thewritePaint(Paint, ObjectOutputStream)method.- Parameters:
- stream- the input stream (- nullnot permitted).
- Returns:
- The paint object (possibly null).
- Throws:
- IOException- if there is an I/O problem.
- ClassNotFoundException- if there is a problem loading a class.
 
- 
writePaintSerialises aPaintobject.- Parameters:
- paint- the paint object (- nullpermitted).
- stream- the output stream (- nullnot permitted).
- Throws:
- IOException- if there is an I/O error.
 
- 
readStrokepublic static Stroke readStroke(ObjectInputStream stream) throws IOException, ClassNotFoundException Reads aStrokeobject that has been serialised by thewriteStroke(Stroke, ObjectOutputStream)method.- Parameters:
- stream- the input stream (- nullnot permitted).
- Returns:
- The stroke object (possibly null).
- Throws:
- IOException- if there is an I/O problem.
- ClassNotFoundException- if there is a problem loading a class.
 
- 
writeStrokeSerialises aStrokeobject. This code handles theBasicStrokeclass which is the onlyStrokeimplementation provided by the JDK (and isn't directlySerializable).- Parameters:
- stroke- the stroke object (- nullpermitted).
- stream- the output stream (- nullnot permitted).
- Throws:
- IOException- if there is an I/O error.
 
- 
readCompositepublic static Composite readComposite(ObjectInputStream stream) throws IOException, ClassNotFoundException Reads aCompositeobject that has been serialised by thewriteComposite(Composite, ObjectOutputStream)method.- Parameters:
- stream- the input stream (- nullnot permitted).
- Returns:
- The composite object (possibly null).
- Throws:
- IOException- if there is an I/O problem.
- ClassNotFoundException- if there is a problem loading a class.
 
- 
writeCompositepublic static void writeComposite(Composite composite, ObjectOutputStream stream) throws IOException Serialises aCompositeobject.- Parameters:
- composite- the composite object (- nullpermitted).
- stream- the output stream (- nullnot permitted).
- Throws:
- IOException- if there is an I/O error.
 
- 
readShapeReads aShapeobject that has been serialised by thewriteShape(Shape, ObjectOutputStream)method.- Parameters:
- stream- the input stream (- nullnot permitted).
- Returns:
- The shape object (possibly null).
- Throws:
- IOException- if there is an I/O problem.
- ClassNotFoundException- if there is a problem loading a class.
 
- 
writeShapeSerialises aShapeobject.- Parameters:
- shape- the shape object (- nullpermitted).
- stream- the output stream (- nullnot permitted).
- Throws:
- IOException- if there is an I/O error.
 
- 
readPoint2DReads aPoint2Dobject that has been serialised by thewritePoint2D(Point2D, ObjectOutputStream)method.- Parameters:
- stream- the input stream (- nullnot permitted).
- Returns:
- The point object (possibly null).
- Throws:
- IOException- if there is an I/O problem.
 
- 
writePoint2DSerialises aPoint2Dobject.- Parameters:
- p- the point object (- nullpermitted).
- stream- the output stream (- nullnot permitted).
- Throws:
- IOException- if there is an I/O error.
 
- 
readAttributedStringpublic static AttributedString readAttributedString(ObjectInputStream stream) throws IOException, ClassNotFoundException Reads aAttributedStringobject that has been serialised by thewriteAttributedString(AttributedString, ObjectOutputStream)method.- Parameters:
- stream- the input stream (- nullnot permitted).
- Returns:
- The attributed string object (possibly null).
- Throws:
- IOException- if there is an I/O problem.
- ClassNotFoundException- if there is a problem loading a class.
 
- 
writeAttributedStringpublic static void writeAttributedString(AttributedString as, ObjectOutputStream stream) throws IOException Serialises anAttributedStringobject.- Parameters:
- as- the attributed string object (- nullpermitted).
- stream- the output stream (- nullnot permitted).
- Throws:
- IOException- if there is an I/O error.
 
 
-