|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.media.jai.remote.SerializerFactory
A utility class which provides factory methods for obtaining
Serializer
instances.
The Serializer
s are maintained in a centralized repository
which is organized based on the classes supported by the
Serializer
s and the order in which the Serializer
s
were registered. Convenience methods similar to those defined in the
Serializer
class are also provided. These enable
functionality equivalent to a single Serializer
which
supports all the classes supported by the aggregate of all
Serializer
s resident in the repository.
By default Serializer
s for the following classes
are registered by JAI:
java.awt.RenderingHints
Serializable
nor supported by
SerializerFactory
are omitted; support for specific
RenderingHints.Key
subclasses may be added by new
Serializer
s);java.awt.RenderingHints.Key
RenderingHints.Key
s defined in
java.awt.RenderingHints
and javax.media.jai.JAI
);
java.awt.Shape
;java.awt.image.DataBufferByte
;java.awt.image.DataBufferShort
;java.awt.image.DataBufferUShort
;java.awt.image.DataBufferInt
;javax.media.jai.DataBufferFloat
;javax.media.jai.DataBufferDouble
;java.awt.image.ComponentSampleModel
;java.awt.image.BandedSampleModel
;java.awt.image.PixelInterleavedSampleModel
;java.awt.image.SinglePixelPackedSampleModel
;java.awt.image.MultiPixelPackedSampleModel
;javax.media.jai.ComponentSampleModelJAI
;java.awt.image.Raster
Raster
s which have a DataBuffer
and SampleModel
supported by a Serializer
);java.awt.image.WritableRaster
WritableRaster
s which have a
DataBuffer
and SampleModel
supported by a
Serializer
);java.awt.image.ComponentColorModel
;java.awt.image.IndexColorModel
;java.awt.image.DirectColorModel
;javax.media.jai.FloatColorModel
;java.awt.image.renderable.RenderContext
;RenderingHints
Serializer
);
java.awt.image.RenderedImage
RenderedImage
s which have Raster
s
and a ColorModel
supported by a Serializer
);java.awt.image.WritableRenderedImage
WritableRenderedImage
s which have
Raster
s and a ColorModel
supported by a
Serializer
);java.io.Serializable
;java.util.HashSet
Serializable
nor supported by
SerializerFactory
are omitted);java.util.Hashtable
Serializable
nor supported by
SerializerFactory
are omitted);java.util.Vector
Serializable
nor supported by
SerializerFactory
are omitted);
SerializableState
,
Serializer
,
Serializable
Constructor Summary | |
protected |
SerializerFactory()
|
Method Summary | |
static Class |
getDeserializedClass(Class c)
Determines the Class of which the deserialized form of the
supplied Class will be an instance. |
static Serializer |
getSerializer(Class c)
Retrieves a Serializer for a given class c . |
static Serializer[] |
getSerializers(Class c)
Retrieves an array of all Serializer s currently
resident in the repository which directly support the specified
Class . |
static SerializableState |
getState(Object o)
A convenience wrapper around getState(Object o, RenderingHints h) with
the RenderingHints parameter h set
to null . |
static SerializableState |
getState(Object o,
RenderingHints h)
Converts an object into a state-preserving object which may be serialized. |
static Class[] |
getSupportedClasses()
Returns an array listing all classes and interfaces on which the isSupportedClass() method of this class may be invoked
and return true . |
static boolean |
isSupportedClass(Class c)
Whether there is currently resident in the repository a Serializer the getSupportedClass()
method of which returns a value equal to the parameter supplied
to this method according to equals() . |
static void |
registerSerializer(Serializer s)
Adds a Serializer to the repository. |
static void |
unregisterSerializer(Serializer s)
Removes a Serializer from the repository. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
protected SerializerFactory()
Method Detail |
public static void registerSerializer(Serializer s)
Serializer
to the repository.s
- The Serializer
s to be added to the repository.IllegalArgumentException
- if s
is
null
public static void unregisterSerializer(Serializer s)
Serializer
from the repository.s
- The Serializer
s to be removed from the repository.IllegalArgumentException
- if s
is
null
public static Serializer[] getSerializers(Class c)
Serializer
s currently
resident in the repository which directly support the specified
Class
. Serializer
s which support
a superclass of the specified class and permit subclass
serialization will not be included.c
- The class for which Serializer
s will be
retrieved.IllegalArgumentException
- if c
is
null
.public static Serializer getSerializer(Class c)
Serializer
for a given class c
.
If more than one Serializer
is available for the class
then the most recently registered Serializer
will be
returned. If no registered Serializer
exists which
directly supports the specified class, i.e., one for which the
getSupportedClass()
returns a value equal to the
specified class, then a Serializer
may be returned
which is actually registered against a superclass but permits
subclass serialization.c
- The class for which Serializer
s will be
retrieved.Serializer
which supports the specified class.
or null
if none is available.IllegalArgumentException
- if c
is
null
.BandedSampleModel
,
ComponentSampleModel
public static boolean isSupportedClass(Class c)
Serializer
the getSupportedClass()
method of which returns a value equal to the parameter supplied
to this method according to equals()
.c
- The class to be tested for compatibility.IllegalArgumentException
- if c
is
null
public static Class[] getSupportedClasses()
isSupportedClass()
method of this class may be invoked
and return true
.public static Class getDeserializedClass(Class c)
Class
of which the deserialized form of the
supplied Class
will be an instance. Specifically, this
method returns the Class
of the Object
returned by invoking getObject()
on the
SerializableState
returned by getState()
after the state object has been serialized and deserialized. The
returned value will equal the supplied argument unless there is no
Serializer
explicitly registered for this class but there
is a Serializer
registered for a superclass with a
permitsSubclasses()
method that returns
true
.The
- Class
for which the deserialized class type is
requested.Class
or null
.IllegalArgumentException
- if c
is
null
public static SerializableState getState(Object o, RenderingHints h)
isSupportedClass(o.getClass())
returns true
, then the object will be converted into
a form which may be deserialized into an instance of the same class.
If the class is not supported explicitly but implements one or
more supported interfaces, then it will be converted into a
form which may be deserialized into an instance of an unspecified
class which implements all interfaces which are both implemented by
the class of the object and supported by some Serializer
currently resident in the repository. If the object is
null
, the returned SerializableState
will
return null
from its getObject()
method
and java.lang.Object.class
from its
getObjectClass()
method.o
- The object to be converted into a serializable form.h
- Configuration parameters the exact nature of which is
Serializer
-dependent. If null
,
reasonable default settings should be used.IllegalArgumentException
- if o
is
non-null
and either
isSupportedClass(o.getClass())
returns
false
, or o
is not an instance of a class supported by a
Serializer
in the repository or which
implements at least one interface supported by some
Serializer
s in the repository.public static final SerializableState getState(Object o)
getState(Object o, RenderingHints h)
with
the RenderingHints
parameter h
set
to null
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |