/// <summary>Reads the contents of an encapsulation from the buffer, with the encapsulation header encoded /// using the 2.0 encoding.</summary> /// <typeparam name="T">The type of the contents.</typeparam> /// <param name="buffer">The byte buffer.</param> /// <param name="payloadReader">The <see cref="InputStreamReader{T}"/> that reads the payload of the /// encapsulation using an <see cref="InputStream"/>.</param> /// <param name="communicator">The communicator (optional).</param> /// <param name="connection">The connection (optional).</param> /// <param name="proxy">The proxy (optional).</param> /// <returns>The contents of the encapsulation read from the buffer.</returns> /// <exception name="InvalidDataException">Thrown when <c>buffer</c> is not a valid encapsulation or /// <c>payloadReader</c> finds invalid data.</exception> /// <remarks>When reading classes, proxies or exceptions, communicator, connection or proxy must be non-null. /// </remarks> public static T ReadEncapsulation <T>( this ReadOnlyMemory <byte> buffer, InputStreamReader <T> payloadReader, Communicator?communicator = null, Connection?connection = null, IObjectPrx?proxy = null) => buffer.ReadEncapsulation(Encoding.V20, payloadReader, communicator, connection, proxy);
/// <summary>Reads the contents of an encapsulation from the buffer, with the encapsulation header encoded /// using the 2.0 encoding.</summary> /// <typeparam name="T">The type of the contents.</typeparam> /// <param name="buffer">The byte buffer.</param> /// <param name="communicator">The communicator.</param> /// <param name="payloadReader">The <see cref="InputStreamReader{T}"/> that reads the payload of the /// encapsulation using an <see cref="InputStream"/>.</param> /// <returns>The contents of the encapsulation read from the buffer.</returns> /// <exception name="InvalidDataException">Thrown when <c>buffer</c> is not a valid encapsulation or /// <c>payloadReader</c> finds invalid data.</exception> public static T ReadEncapsulation <T>( this ReadOnlyMemory <byte> buffer, Communicator communicator, InputStreamReader <T> payloadReader) => buffer.ReadEncapsulation(Encoding.V20, communicator, payloadReader);