com.cedarsoft.serialization
Class AbstractSerializer<T,S,D,E extends java.lang.Throwable>

java.lang.Object
  extended by com.cedarsoft.serialization.AbstractSerializer<T,S,D,E>
Type Parameters:
T - the type
S - the object to serialize to
D - the object to deserialize from
E - the exception that might be thrown
All Implemented Interfaces:
ExtendedSerializer<T>, PluggableSerializer<T,S,D,E>, Serializer<T,Lookup>
Direct Known Subclasses:
AbstractJDomSerializer, AbstractStaxMateSerializer

public abstract class AbstractSerializer<T,S,D,E extends java.lang.Throwable>
extends java.lang.Object
implements PluggableSerializer<T,S,D,E>


Constructor Summary
protected AbstractSerializer(java.lang.String defaultElementName)
           
 
Method Summary
 T deserialize(java.io.InputStream in)
          Deserializes the object
protected  java.lang.String getDefaultElementName()
           
 byte[] serialize(T object)
          Serializes the given object
 void serialize(T object, java.io.OutputStream out)
          Serializes the object to the output stream
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.cedarsoft.serialization.PluggableSerializer
deserialize, serialize
 
Methods inherited from interface com.cedarsoft.serialization.Serializer
deserialize, serialize
 

Constructor Detail

AbstractSerializer

protected AbstractSerializer(@NotNull@NonNls
                             java.lang.String defaultElementName)
Method Detail

getDefaultElementName

@NotNull
@NonNls
protected java.lang.String getDefaultElementName()

serialize

@NotNull
public byte[] serialize(@NotNull
                                T object)
                 throws java.io.IOException
Description copied from interface: ExtendedSerializer
Serializes the given object

Specified by:
serialize in interface ExtendedSerializer<T>
Parameters:
object - the object
Returns:
the serialized object
Throws:
java.io.IOException

serialize

public void serialize(@NotNull
                      T object,
                      @NotNull
                      java.io.OutputStream out)
               throws java.io.IOException
Description copied from interface: ExtendedSerializer
Serializes the object to the output stream

Specified by:
serialize in interface ExtendedSerializer<T>
Parameters:
object - the object
out - the out stream
Throws:
java.io.IOException

deserialize

@NotNull
public T deserialize(@NotNull
                             java.io.InputStream in)
              throws java.io.IOException
Description copied from interface: ExtendedSerializer
Deserializes the object

Specified by:
deserialize in interface ExtendedSerializer<T>
Parameters:
in - the input stream
Returns:
the deserialized object
Throws:
java.io.IOException


Copyright © 2009 cedarsoft GmbH. All Rights Reserved.