de.netseeker.ejoe.adapter
Interface SerializeAdapter

All Superinterfaces:
java.io.Serializable
All Known Implementing Classes:
BaseAdapter, BetwixtAdapter, CastorAdapter, HessianAdapter, JavaBeansXmlAdapter, JavolutionAdapter, Jaxb2Adapter, JsonLibAdapter, JsonToolsAdapter, JSXAdapter, MyJsonAdapter, ObjectStreamAdapter, SkaringaAdapter, SojoAdapter, SojoJsonAdapter, UTF8StringAdapter, XmlBeansAdapter, XStreamAdapter, XStreamJsonAdapter

public interface SerializeAdapter
extends java.io.Serializable

Interface defining all methods required by a (de)serialize adapter.

Since:
0.3.0
Author:
netseeker aka Michael Manske

Method Summary
 java.lang.String getContentType()
           
 void handleClassLoaderChange(java.lang.ClassLoader classLoader)
          Signals a change of the ContextClassLoader of the current thread to the adapter.
 boolean isSelfBuffered()
          Indicates that the adapter uses a StreamBuffer mechanism and doesn't require a buffered input stream
 java.lang.Object read(java.io.InputStream in)
          Deserializes an object out of an given InputStream
 boolean requiresCustomEOFHandling()
          Signals if this adapter has problems with EJOE's UncloseableInputStreams and requires a really closed Stream (which EJOE prevents to ensure that an adapter can not close the underlying socket unintentionally).
 void write(java.lang.Object obj, java.io.OutputStream out)
          Serializes an object into an output stream
 

Method Detail

read

java.lang.Object read(java.io.InputStream in)
                      throws java.lang.Exception
Deserializes an object out of an given InputStream

Parameters:
in - the input stream to use for deserialization
Returns:
a deserialized object instance
Throws:
java.lang.Exception

write

void write(java.lang.Object obj,
           java.io.OutputStream out)
           throws java.lang.Exception
Serializes an object into an output stream

Parameters:
obj - object that should get serialized
out - the outputstream into which the object should serialized
Throws:
java.lang.Exception

handleClassLoaderChange

void handleClassLoaderChange(java.lang.ClassLoader classLoader)
Signals a change of the ContextClassLoader of the current thread to the adapter. This method will be called when the EJOE client is started with support for remote classloading.

Parameters:
classLoader -

requiresCustomEOFHandling

boolean requiresCustomEOFHandling()
Signals if this adapter has problems with EJOE's UncloseableInputStreams and requires a really closed Stream (which EJOE prevents to ensure that an adapter can not close the underlying socket unintentionally). If the adapter requires closed streams, EJOE will append a custom EOF signature at the end of the stream and return -1 in Inputstream#read when EOF is reached.

Returns:
true if the adapter requires EOF to detect the end of the stream
See Also:
XMLEncoder/Decoder over sockets

isSelfBuffered

boolean isSelfBuffered()
Indicates that the adapter uses a StreamBuffer mechanism and doesn't require a buffered input stream

Returns:
true if the adapter doesn't require a buffered inputstream, otherwise false

getContentType

java.lang.String getContentType()
Returns:
A recognized mime type
See Also:
mime type list of IANA


Copyright © 2005-2007 netseeker. All Rights Reserved.