Table of Contents

Class MessageWriter

Namespace
QuickLink.Messaging
Assembly
QuickLink.dll

Represents a writer for creating binary messages.

public class MessageWriter : IDisposable
Inheritance
MessageWriter
Implements
Inherited Members

This class provides methods for writing various data types to a memory stream.

Constructors

Initializes a new instance of the MessageWriter class with the specified message type.

public MessageWriter(MessageType type)

Parameters

type MessageType

The message type.

Methods

Releases all resources used by the MessageWriter object.

public void Dispose()

Releases the unmanaged resources used by the MessageWriter object and optionally releases the managed resources.

protected virtual void Dispose(bool disposing)

Parameters

disposing bool

true to release both managed and unmanaged resources; false to release only unmanaged resources.

Finalizes an instance of the MessageWriter class.

protected ~MessageWriter()

Returns the contents of the underlying memory stream as a byte array.

public byte[] ToArray()

Returns

byte[]

A byte array containing the contents of the memory stream.

Creates a MessageReader instance from the current state of the underlying memory stream.

public MessageReader ToReader()

Returns

MessageReader

A new MessageReader instance.

Writes a boolean to the underlying memory stream

public void WriteBool(bool value)

Parameters

value bool

The value to write

Writes a byte to the underlying memory stream

public void WriteByte(byte value)

Parameters

value byte

The value to write

Writes a byte array to the underlying memory stream.

public void WriteBytes(byte[] data, int offset, int length)

Parameters

data byte[]

The byte array to write.

offset int

The zero-based byte offset in data at which to begin writing.

length int

The number of bytes to write.

Writes a 32-bit signed double to the underlying memory stream.

public void WriteDouble(double value)

Parameters

value double

The value to write.

Writes a 32-bit signed float to the underlying memory stream.

public void WriteFloat(float value)

Parameters

value float

The value to write.

Writes a 16-bit signed integer to the underlying memory stream.

public void WriteInt16(int value)

Parameters

value int

The value to write.

Writes a 32-bit signed integer to the underlying memory stream.

public void WriteInt32(int value)

Parameters

value int

The value to write.

Writes a string to the underlying memory stream.

public void WriteString(string value)

Parameters

value string

The string to write.

Writes a 16-bit unsigned integer to the underlying memory stream.

public void WriteUInt16(uint value)

Parameters

value uint

The value to write.

Writes a 32-bit unsigned integer to the underlying memory stream.

public void WriteUInt32(uint value)

Parameters

value uint

The value to write.