C# Class Griffin.Net.Protocols.MicroMsg.MicroMessageEncoder

Takes any object that the serializer supports and transfers it over the wire.
The encoder also natively supports byte[] arrays and Stream derived objects (as long as the stream have a size specified). These objects will be transferred without invoking the serializer.
Inheritance: IMessageEncoder
ファイルを表示 Open project: jgauffin/Griffin.Framework Class Usage Examples

Public Methods

Method Description
Clear ( ) : void

Remove everything used for the last message

MicroMessageEncoder ( IMessageSerializer serializer ) : System

Initializes a new instance of the MicroMessageEncoder class.

MicroMessageEncoder ( IMessageSerializer serializer, IBufferSlice bufferSlice ) : System

Initializes a new instance of the MicroMessageEncoder class.

OnSendCompleted ( int bytesTransferred ) : bool

The previous IMessageEncoder.Send has just completed.

true if the message have been sent successfully; otherwise false.

Prepare ( object message ) : void

Are about to send a new message

Can be used to prepare the next message. for instance serialize it etc.

Send ( ISocketBuffer args ) : void

Serialize message and sent it add it to the buffer

Private Methods

Method Description
CreateHeader ( ) : int

Method Details

Clear() public method

Remove everything used for the last message
public Clear ( ) : void
return void

MicroMessageEncoder() public method

Initializes a new instance of the MicroMessageEncoder class.
public MicroMessageEncoder ( IMessageSerializer serializer ) : System
serializer IMessageSerializer /// Serializer used to serialize the messages that should be sent. You might want to pick a /// serializer which is reasonable fast. ///
return System

MicroMessageEncoder() public method

Initializes a new instance of the MicroMessageEncoder class.
/// bufferSlice; At least the header should fit in the buffer, and the header /// can be up to 520 bytes in the current version. ///
public MicroMessageEncoder ( IMessageSerializer serializer, IBufferSlice bufferSlice ) : System
serializer IMessageSerializer /// Serializer used to serialize the messages that should be sent. You might want to pick a /// serializer which is reasonable fast. ///
bufferSlice IBufferSlice Used when sending information.
return System

OnSendCompleted() public method

The previous IMessageEncoder.Send has just completed.
true if the message have been sent successfully; otherwise false.
public OnSendCompleted ( int bytesTransferred ) : bool
bytesTransferred int
return bool

Prepare() public method

Are about to send a new message
Can be used to prepare the next message. for instance serialize it etc.
Message is of a type that the encoder cannot handle.
public Prepare ( object message ) : void
message object Message to send
return void

Send() public method

Serialize message and sent it add it to the buffer
public Send ( ISocketBuffer args ) : void
args ISocketBuffer Socket buffer
return void