org.objectweb.dream.message.codec
Class BasicStreamMessageCodecImpl

java.lang.Object
  extended byorg.objectweb.dream.AbstractComponent
      extended byorg.objectweb.dream.message.codec.BasicStreamMessageCodecImpl
All Implemented Interfaces:
BindingController, LifeCycleController, Loggable, MessageCodec

public class BasicStreamMessageCodecImpl
extends AbstractComponent
implements MessageCodec

Basic implementation of a message codec. It encodes or decodes messages using ObjectOutputand ObjectInput.


Field Summary
protected  MessageManager messageManagerItf
           
 
Fields inherited from class org.objectweb.dream.AbstractComponent
bindingLogger, componentDesc, fcState, lifeCycleLogger, logger, weaveableC
 
Fields inherited from interface org.objectweb.dream.message.codec.MessageCodec
ITF_NAME
 
Fields inherited from interface org.objectweb.fractal.api.control.LifeCycleController
STARTED, STOPPED
 
Constructor Summary
BasicStreamMessageCodecImpl()
           
 
Method Summary
 void bindFc(String clientItfName, Object serverItf)
           
 Message decode(Object stream)
          Can decode message from an ObjectInputor from an InputStream.
 void encode(Object stream, Message message)
          Can encode message to an ObjectOutputor to an OutputStream.
 String[] listFc()
           
 
Methods inherited from class org.objectweb.dream.AbstractComponent
getFcState, initComponent, lookupFc, setLogger, startFc, stopFc, unbindFc
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

messageManagerItf

protected MessageManager messageManagerItf
Constructor Detail

BasicStreamMessageCodecImpl

public BasicStreamMessageCodecImpl()
Method Detail

decode

public Message decode(Object stream)
               throws IOException
Can decode message from an ObjectInputor from an InputStream. If the given stream is an InputStream, an ObjectInputStreamis created, the message is red, then the ObjectInputStreamis closed.

Specified by:
decode in interface MessageCodec
Parameters:
stream - a stream on which the message is decoded.
Returns:
a message
Throws:
IOException - if an error occurs during the deserialization.
See Also:
MessageCodec.decode(Object)

encode

public void encode(Object stream,
                   Message message)
            throws IOException
Can encode message to an ObjectOutputor to an OutputStream. If the given stream is an OutputStream, an ObjectOutputStreamis created, the message is written, then the ObjectOutputStreamis closed.

Specified by:
encode in interface MessageCodec
Parameters:
stream - a stream on which the message is encoded.
message - a message to serialize.
Throws:
IOException - if an error occurs during the serialization.
See Also:
MessageCodec.encode(Object, Message)

listFc

public String[] listFc()
Specified by:
listFc in interface BindingController
See Also:
BindingController.listFc()

bindFc

public void bindFc(String clientItfName,
                   Object serverItf)
            throws NoSuchInterfaceException,
                   IllegalBindingException,
                   IllegalLifeCycleException
Specified by:
bindFc in interface BindingController
Overrides:
bindFc in class AbstractComponent
Throws:
NoSuchInterfaceException
IllegalBindingException
IllegalLifeCycleException
See Also:
BindingController.bindFc(String, Object)


Copyright © 2003, 2004 - INRIA Rhone-Alpes - All Rights Reserved.