org.spicefactory.cinnamon.io
Interface IoHandler

All Known Implementing Classes:
NetConnectionIoHandler

public interface IoHandler

An IoHandler implementation is responsible for decoding and encoding to/from AMF3.

Cinnamon comes with a default implementation (NetConnectionIoHandler) that should be used when you use the default NetConnectionServiceChannel on the client side.

Author:
Jens Halm

Method Summary
 Envelope createResponseEnvelope(Envelope requestEnvelope)
          Creates a new Envelope to be used for the response sent to the client
 MessageHolder createResponseMessage(MessageHolder requestMessage, Object message, boolean isError)
          Creates a new response messages for the specified request message and result object.
 Envelope decodeAMF(AMFInput input)
          Reads and returns the AMF envelope containing all AMF request messages from the specified input.
 void encodeAMF(AMFOutput output, Envelope envelope)
          Encodes and writes the specified envelope containing all response messages to the output.
 

Method Detail

decodeAMF

Envelope decodeAMF(AMFInput input)
Reads and returns the AMF envelope containing all AMF request messages from the specified input.

Parameters:
input - the AMF input to read from
Returns:
the AMF envelope containing all AMF request messages

encodeAMF

void encodeAMF(AMFOutput output,
               Envelope envelope)
Encodes and writes the specified envelope containing all response messages to the output.

Parameters:
output - the AMF output to write to
envelope - the envelope containing all AMF response messages

createResponseEnvelope

Envelope createResponseEnvelope(Envelope requestEnvelope)
Creates a new Envelope to be used for the response sent to the client

Parameters:
requestEnvelope - the corresponding request envelope
Returns:
a new Envelope to be used for the response sent to the client

createResponseMessage

MessageHolder createResponseMessage(MessageHolder requestMessage,
                                    Object message,
                                    boolean isError)
Creates a new response messages for the specified request message and result object.

Parameters:
requestMessage - the request message that was processed
message - the message to sent as a response
isError - whether the response message represents an error
Returns:
a new response messages for the specified request message and result object