MessageEncoder.ReadMessage MessageEncoder.ReadMessage MessageEncoder.ReadMessage Method

Definition

When overridden in a derived class, reads a message from a specified stream.

Overloads

ReadMessage(ArraySegment<Byte>, BufferManager) ReadMessage(ArraySegment<Byte>, BufferManager) ReadMessage(ArraySegment<Byte>, BufferManager)

When overridden in a derived class, reads a message from a specified buffer.

ReadMessage(Stream, Int32) ReadMessage(Stream, Int32) ReadMessage(Stream, Int32)

When overridden in a derived class, reads a message from a specified stream.

ReadMessage(ArraySegment<Byte>, BufferManager, String) ReadMessage(ArraySegment<Byte>, BufferManager, String) ReadMessage(ArraySegment<Byte>, BufferManager, String)

When overridden in a derived class, reads a message from a specified stream.

ReadMessage(Stream, Int32, String) ReadMessage(Stream, Int32, String) ReadMessage(Stream, Int32, String)

When overridden in a derived class, reads a message from a specified stream.

ReadMessage(ArraySegment<Byte>, BufferManager) ReadMessage(ArraySegment<Byte>, BufferManager) ReadMessage(ArraySegment<Byte>, BufferManager)

When overridden in a derived class, reads a message from a specified buffer.

public:
 System::ServiceModel::Channels::Message ^ ReadMessage(ArraySegment<System::Byte> buffer, System::ServiceModel::Channels::BufferManager ^ bufferManager);
public System.ServiceModel.Channels.Message ReadMessage (ArraySegment<byte> buffer, System.ServiceModel.Channels.BufferManager bufferManager);
member this.ReadMessage : ArraySegment<byte> * System.ServiceModel.Channels.BufferManager -> System.ServiceModel.Channels.Message

Parameters

buffer
ArraySegment<Byte>

A ArraySegment<T> of type Byte that provides the buffer from which the message is deserialized.

bufferManager
BufferManager BufferManager BufferManager

The BufferManager that manages the buffer from which the message is deserialized.

Returns

The Message that is read from the buffer specified.

ReadMessage(Stream, Int32) ReadMessage(Stream, Int32) ReadMessage(Stream, Int32)

When overridden in a derived class, reads a message from a specified stream.

public:
 System::ServiceModel::Channels::Message ^ ReadMessage(System::IO::Stream ^ stream, int maxSizeOfHeaders);
public System.ServiceModel.Channels.Message ReadMessage (System.IO.Stream stream, int maxSizeOfHeaders);
member this.ReadMessage : System.IO.Stream * int -> System.ServiceModel.Channels.Message

Parameters

stream
Stream Stream Stream

The Stream object from which the message is read.

maxSizeOfHeaders
Int32 Int32 Int32

The maximum size of the headers that can be read from the message.

Returns

The Message that is read from the stream specified.

ReadMessage(ArraySegment<Byte>, BufferManager, String) ReadMessage(ArraySegment<Byte>, BufferManager, String) ReadMessage(ArraySegment<Byte>, BufferManager, String)

When overridden in a derived class, reads a message from a specified stream.

public:
 abstract System::ServiceModel::Channels::Message ^ ReadMessage(ArraySegment<System::Byte> buffer, System::ServiceModel::Channels::BufferManager ^ bufferManager, System::String ^ contentType);
public abstract System.ServiceModel.Channels.Message ReadMessage (ArraySegment<byte> buffer, System.ServiceModel.Channels.BufferManager bufferManager, string contentType);
abstract member ReadMessage : ArraySegment<byte> * System.ServiceModel.Channels.BufferManager * string -> System.ServiceModel.Channels.Message

Parameters

buffer
ArraySegment<Byte>

A ArraySegment<T> of type Byte that provides the buffer from which the message is deserialized.

bufferManager
BufferManager BufferManager BufferManager

The BufferManager that manages the buffer from which the message is deserialized.

contentType
String String String

The Multipurpose Internet Mail Extensions (MIME) message-level content-type.

Returns

The Message that is read from the stream specified.

Examples

The following code example shows how to implement the ReadMessage(ArraySegment<Byte>, BufferManager, String) method.

public override Message ReadMessage(ArraySegment<byte> buffer, BufferManager bufferManager, string contentType)
{   
    byte[] msgContents = new byte[buffer.Count];
    Array.Copy(buffer.Array, buffer.Offset, msgContents, 0, msgContents.Length);
    bufferManager.ReturnBuffer(buffer.Array);

    MemoryStream stream = new MemoryStream(msgContents);
    return ReadMessage(stream, int.MaxValue);
}

ReadMessage(Stream, Int32, String) ReadMessage(Stream, Int32, String) ReadMessage(Stream, Int32, String)

When overridden in a derived class, reads a message from a specified stream.

public:
 abstract System::ServiceModel::Channels::Message ^ ReadMessage(System::IO::Stream ^ stream, int maxSizeOfHeaders, System::String ^ contentType);
public abstract System.ServiceModel.Channels.Message ReadMessage (System.IO.Stream stream, int maxSizeOfHeaders, string contentType);
abstract member ReadMessage : System.IO.Stream * int * string -> System.ServiceModel.Channels.Message

Parameters

stream
Stream Stream Stream

The Stream object from which the message is read.

maxSizeOfHeaders
Int32 Int32 Int32

The maximum size of the headers that can be read from the message.

contentType
String String String

The Multipurpose Internet Mail Extensions (MIME) message-level content-type.

Returns

The Message that is read from the stream specified.

Examples

The following code example shows how to implement the ReadMessage(Stream, Int32, String) method.

public override Message ReadMessage(Stream stream, int maxSizeOfHeaders, string contentType)
{
    XmlReader reader = XmlReader.Create(stream);
    return Message.CreateMessage(reader, maxSizeOfHeaders, this.MessageVersion);
}

Applies to