MessageEncoder.ReadMessage MessageEncoder.ReadMessage MessageEncoder.ReadMessage Method

定義

在衍生類別中覆寫時,從指定的資料流讀取訊息。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.

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

參數

buffer
ArraySegment<Byte>

ArraySegment<T> 型別的 Byte,提供從其中還原序列化訊息的緩衝區。A ArraySegment<T> of type Byte that provides the buffer from which the message is deserialized.

bufferManager
BufferManager BufferManager BufferManager

BufferManager,管理從其中還原序列化訊息的緩衝區。The BufferManager that manages the buffer from which the message is deserialized.

傳回

從指定之緩衝區讀取的 MessageThe 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

參數

stream
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.

傳回

從指定之資料流讀取的 MessageThe 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

參數

buffer
ArraySegment<Byte>

ArraySegment<T> 型別的 Byte,提供從其中還原序列化訊息的緩衝區。A ArraySegment<T> of type Byte that provides the buffer from which the message is deserialized.

bufferManager
BufferManager BufferManager BufferManager

BufferManager,管理從其中還原序列化訊息的緩衝區。The BufferManager that manages the buffer from which the message is deserialized.

contentType
String String String

多用途網際網路郵件延伸標準 (MIME) 訊息層級內容類型。The Multipurpose Internet Mail Extensions (MIME) message-level content-type.

傳回

從指定之資料流讀取的 MessageThe Message that is read from the stream specified.

範例

下列程式碼範例將示範如何實作 ReadMessage(ArraySegment<Byte>, BufferManager, String) 方法。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

參數

stream
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

多用途網際網路郵件延伸標準 (MIME) 訊息層級內容類型。The Multipurpose Internet Mail Extensions (MIME) message-level content-type.

傳回

從指定之資料流讀取的 MessageThe Message that is read from the stream specified.

範例

下列程式碼範例將示範如何實作 ReadMessage(Stream, Int32, String) 方法。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);
}

適用於