C# Class Lawo.EmberPlusSharp.S101.MessageEncodingStream

Transparently encodes a single message.

At construction, the passed message is first appended to the WriteBuffer object passed to CreateAsync. Afterwards, when data is written to this stream then it is first encoded and the encoded form is then appended to the WriteBuffer object.

Caution: DisposeAsync must be called in the end.

If necessary, the message plus payload is automatically partitioned into multiple packets such that the unencoded length of each packet does not exceed 1024 bytes.

Inheritance: NonSeekableStream
显示文件 Open project: Lawo/ember-plus-sharp Class Usage Examples

Public Methods

Method Description
DisposeAsync ( CancellationToken cancellationToken ) : Task
FlushAsync ( CancellationToken cancellationToken ) : Task
WriteAsync ( byte buffer, int offset, int count, CancellationToken cancellationToken ) : Task

Private Methods

Method Description
CreateAsync ( WriteBuffer rawBuffer, S101Message message, CancellationToken cancellationToken ) : Task
CreateFramingStream ( PacketFlags packetFlags, CancellationToken cancellationToken ) : Task
DisposeAndCreateFramingStreamAsync ( PacketFlags packetFlags, CancellationToken cancellationToken ) : Task
DisposeFramingStream ( CancellationToken cancellationToken ) : Task
MessageEncodingStream ( S101Message message, WriteBuffer rawBuffer, FramingStream framingStream ) : System
WriteOutOfFrameByteAsync ( byte value, CancellationToken cancellationToken ) : Task
WriteUnframedAsync ( byte buffer, int offset, int count, CancellationToken cancellationToken ) : Task

Method Details

DisposeAsync() public final method

public final DisposeAsync ( CancellationToken cancellationToken ) : Task
cancellationToken System.Threading.CancellationToken
return Task

FlushAsync() public final method

public final FlushAsync ( CancellationToken cancellationToken ) : Task
cancellationToken System.Threading.CancellationToken
return Task

WriteAsync() public final method

public final WriteAsync ( byte buffer, int offset, int count, CancellationToken cancellationToken ) : Task
buffer byte
offset int
count int
cancellationToken System.Threading.CancellationToken
return Task