예제 #1
0
                    /// <summary>
                    /// Returns an identical copy of the original message from which this buffer was
                    /// created.
                    /// </summary>
                    /// <returns>A copy of the original message.</returns>
                    /// <exception cref="ObjectDisposedException" />
                    public override Message CreateMessage()
                    {
                        lock (this.ThisLock)
                        {
                            if (this.isClosed)
                            {
                                throw PoxBinaryBufferedMessageBuffer.CreateBufferDisposedException();
                            }

                            PoxBinaryBufferedMessage destinationMessage = new PoxBinaryBufferedMessage(this._data);
                            destinationMessage.Headers.CopyHeadersFrom(this._headers);
                            destinationMessage.Properties.CopyProperties(this._properties);

                            return(destinationMessage);
                        }
                    }
예제 #2
0
                    /// <summary>
                    /// Writes the entire contents of this buffer into the specified stream.
                    /// </summary>
                    /// <param name="stream">The stream that the buffer contents will be written to.</param>
                    /// <exception cref="ArgumentNullException" />
                    /// <exception cref="ObjectDisposedException" />
                    public override void WriteMessage(Stream stream)
                    {
                        if (stream == null)
                        {
                            throw new ArgumentNullException("stream");
                        }

                        lock (this.ThisLock)
                        {
                            if (this.isClosed)
                            {
                                throw PoxBinaryBufferedMessageBuffer.CreateBufferDisposedException();
                            }

                            stream.Write(this._data.Buffer.Array, this._data.Buffer.Offset,
                                         this._data.Buffer.Count);
                        }
                    }