แก้ไข

แชร์ผ่าน


MessageEncoder.ReadMessage Method

Definition

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

Overloads

ReadMessage(Stream, Int32, String)

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

ReadMessage(ArraySegment<Byte>, BufferManager, String)

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

ReadMessage(Stream, Int32)

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

ReadMessage(ArraySegment<Byte>, BufferManager)

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

ReadMessage(Stream, Int32, String)

Source:
MessageEncoder.cs
Source:
MessageEncoder.cs

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
Public MustOverride Function ReadMessage (stream As Stream, maxSizeOfHeaders As Integer, contentType As String) As Message

Parameters

stream
Stream

The Stream object from which the message is read.

maxSizeOfHeaders
Int32

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

contentType
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

ReadMessage(ArraySegment<Byte>, BufferManager, String)

Source:
MessageEncoder.cs
Source:
MessageEncoder.cs

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
Public MustOverride Function ReadMessage (buffer As ArraySegment(Of Byte), bufferManager As BufferManager, contentType As String) As Message

Parameters

buffer
ArraySegment<Byte>

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

bufferManager
BufferManager

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

contentType
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);
}

Applies to

ReadMessage(Stream, Int32)

Source:
MessageEncoder.cs
Source:
MessageEncoder.cs

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
Public Function ReadMessage (stream As Stream, maxSizeOfHeaders As Integer) As Message

Parameters

stream
Stream

The Stream object from which the message is read.

maxSizeOfHeaders
Int32

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

Returns

The Message that is read from the stream specified.

Applies to

ReadMessage(ArraySegment<Byte>, BufferManager)

Source:
MessageEncoder.cs
Source:
MessageEncoder.cs

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
Public Function ReadMessage (buffer As ArraySegment(Of Byte), bufferManager As BufferManager) As Message

Parameters

buffer
ArraySegment<Byte>

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

bufferManager
BufferManager

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

Returns

The Message that is read from the buffer specified.

Applies to