com.sibvisions.rad.remote
Class UniversalSerializer

java.lang.Object
  extended by com.sibvisions.rad.remote.UniversalSerializer
All Implemented Interfaces:
ISerializer

public final class UniversalSerializer
extends java.lang.Object
implements ISerializer

The UniversalSerializer converts an object state into a byte stream in such a way that the byte stream can be converted back into a copy of the object.

See Also:
ISerializer

Constructor Summary
UniversalSerializer()
          Creates a new instance of UniversalSerializer with default serializer registrations.
 
Method Summary
 ITypeSerializer getTypeSerializer(java.lang.Class<?> pTypeClass)
          Gets the ITypeSerializer for a type value.
 ITypeSerializer getTypeSerializer(int pTypeValue)
          Gets the ITypeSerializer for a type value.
 ITypeSerializer getTypeSerializer(java.lang.Object pObject)
          Gets the ITypeSerializer for a type value.
 java.lang.Object read(java.io.DataInputStream pIn)
          Reads in a serialized object from a stream.
 java.lang.Object read(java.io.DataInputStream pIn, TypeCache pCache)
          Reads in a serialized object from a stream.
 void registerTypeSerializer(ITypeSerializer pTypeSerializer)
          Registers a type serializer.
 void unregisterTypeSerializer(ITypeSerializer pTypeSerializer)
          Unregisters a type serializer.
 void write(java.io.DataOutputStream pOut, java.lang.Object pObject)
          Writes a serialized object to a stream.
 void write(java.io.DataOutputStream pOut, java.lang.Object pObject, TypeCache pCache)
          Writes a serialized object to a stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UniversalSerializer

public UniversalSerializer()
Creates a new instance of UniversalSerializer with default serializer registrations.

Method Detail

read

public final java.lang.Object read(java.io.DataInputStream pIn)
                            throws java.lang.Exception
Reads in a serialized object from a stream.

Specified by:
read in interface ISerializer
Parameters:
pIn - stream with serialized content
Returns:
deserialized object
Throws:
java.lang.Exception - if deserialization fails

write

public final void write(java.io.DataOutputStream pOut,
                        java.lang.Object pObject)
                 throws java.lang.Exception
Writes a serialized object to a stream.

Specified by:
write in interface ISerializer
Parameters:
pOut - output stream for the object
pObject - serializable object
Throws:
java.lang.Exception - if serialization fails

read

public final java.lang.Object read(java.io.DataInputStream pIn,
                                   TypeCache pCache)
                            throws java.lang.Exception
Reads in a serialized object from a stream.

Parameters:
pIn - stream with serialized content
pCache - the cache for optimized bean transfer
Returns:
deserialized object
Throws:
java.lang.Exception - if deserialization fails

write

public final void write(java.io.DataOutputStream pOut,
                        java.lang.Object pObject,
                        TypeCache pCache)
                 throws java.lang.Exception
Writes a serialized object to a stream.

Parameters:
pOut - output stream for the object
pObject - serializable object
pCache - the cache for optimized bean transfer
Throws:
java.lang.Exception - if serialization fails

registerTypeSerializer

public void registerTypeSerializer(ITypeSerializer pTypeSerializer)
Registers a type serializer.

Parameters:
pTypeSerializer - the type serializer.
Throws:
java.lang.IllegalArgumentException - if the byte range is already used

unregisterTypeSerializer

public void unregisterTypeSerializer(ITypeSerializer pTypeSerializer)
Unregisters a type serializer.

Parameters:
pTypeSerializer - the type serializer.

getTypeSerializer

public ITypeSerializer getTypeSerializer(int pTypeValue)
                                  throws java.io.IOException
Gets the ITypeSerializer for a type value.

Parameters:
pTypeValue - the type value.
Returns:
the ITypeSerializer.
Throws:
java.io.IOException - if the type value is unknown.

getTypeSerializer

public ITypeSerializer getTypeSerializer(java.lang.Class<?> pTypeClass)
                                  throws java.io.IOException
Gets the ITypeSerializer for a type value.

Parameters:
pTypeClass - the type value.
Returns:
the ITypeSerializer.
Throws:
java.io.IOException - if the type value is unknown.

getTypeSerializer

public ITypeSerializer getTypeSerializer(java.lang.Object pObject)
                                  throws java.io.IOException
Gets the ITypeSerializer for a type value.

Parameters:
pObject - the type value.
Returns:
the ITypeSerializer.
Throws:
java.io.IOException - if the type value is unknown.


Copyright © 2009 SIB Visions GmbH. All Rights Reserved.