/// <summary> /// Initializes a new instance of the <see cref="BizTalkMessagePartStream"/> class. /// </summary> /// <param name="stream">The stream from which to read (or write if in compression mode).</param> /// <param name="mode">The compression mode.</param> public BizTalkMessagePartStream(Stream stream, StreamMode mode) { this.innerStream = stream; this.streamMode = mode; if (mode == StreamMode.Write) { this.writeStream = new BizTalkBlockStream(this.innerStream); } else if (mode == StreamMode.Read) { this.reader = new BizTalkBlockReader(stream); this.readBuffer = new MemoryStream(); } else { throw new ArgumentException("Unknown stream mode specified: " + mode, "mode"); } }