|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbb.gui.BasicStrokeSerializer
public class BasicStrokeSerializer
The sole purpose of this class is to aid classes which have a BasicStroke field that needs to get serialized.
This class would be unnecessary of Sun were to merely make BasicStroke implement Serializable. I filed a bug report with Sun about this; it has been assigned an internal review ID of: 383603
This class's instance part multithread safe: it is immutable (both its immediate state, as well as the deep state of its fields).
However, the static write
and read
methods restrict the calling thread to
EventQueue
's dispatch thread
because they deal with a BasicStroke
instance.
Nested Class Summary | |
---|---|
static class |
BasicStrokeSerializer.UnitTest
See the Overview page of the project's javadocs for a general description of this unit test class. |
Field Summary | |
---|---|
private int |
cap
|
private float[] |
dash
|
private float |
dash_phase
|
private int |
join
|
private float |
miterlimit
|
private static long |
serialVersionUID
|
private float |
width
|
Constructor Summary | |
---|---|
BasicStrokeSerializer(BasicStroke basicStroke)
Creates a new BasicStrokeSerializer instance. |
Method Summary | |
---|---|
BasicStroke |
convert()
Converts this instance into a new BasicStroke instance and returns it. |
static BasicStroke |
read(ObjectInputStream objectInputStream)
Deserializes a BasicStrokeSerializer object from objectInputStream, converts it to a new BasicStroke instance, and returns it. |
static void |
write(BasicStroke basicStroke,
ObjectOutputStream objectOutputStream)
Constructs a new BasicStrokeSerializer(java.awt.BasicStroke) instance from basicStroke
and serializes it to objectOutputStream. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final long serialVersionUID
private final float width
private final int cap
private final int join
private final float miterlimit
private final float[] dash
private final float dash_phase
Constructor Detail |
---|
public BasicStrokeSerializer(BasicStroke basicStroke) throws IllegalArgumentException
IllegalArgumentException
- if basicStroke == nullMethod Detail |
---|
public static void write(BasicStroke basicStroke, ObjectOutputStream objectOutputStream) throws IllegalArgumentException, IllegalStateException, InvalidClassException, NotSerializableException, IOException
BasicStrokeSerializer(java.awt.BasicStroke)
instance from basicStroke
and serializes it to objectOutputStream.
IllegalArgumentException
- if basicStroke == null; objectOutputStream == null
IllegalStateException
- if calling thread is not EventQueue
's dispatch thread
InvalidClassException
- if something is wrong with a class used by serialization
NotSerializableException
- if some object to be serialized does not implement the java.io.Serializable interface
IOException
- if any is thrown by the underlying OutputStreampublic static BasicStroke read(ObjectInputStream objectInputStream) throws IllegalArgumentException, IllegalStateException, ClassNotFoundException, InvalidClassException, StreamCorruptedException, OptionalDataException, IOException, ClassCastException
converts
it to a new BasicStroke instance, and returns it.
IllegalArgumentException
- if objectInputStream == null
IllegalStateException
- if calling thread is not EventQueue
's dispatch thread
ClassNotFoundException
- if a class of a serialized object cannot be found
InvalidClassException
- if something is wrong with a class used by serialization
StreamCorruptedException
- if control information in the stream is inconsistent
OptionalDataException
- if primitive data was found in the stream instead of objects
IOException
- if any is thrown by the underlying InputStream
ClassCastException
- if the next Object on objectInputStream is not a BasicStrokeSerializer instancepublic BasicStroke convert()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |