public void RollbackTransaction()
        {
            if (!inTransaction)
            {
                throw new InvalidOperationException("Stream is not in transaction");
            }

            WriteBufferedStream bufferedStream = stream as WriteBufferedStream;

            if (bufferedStream != null)
            {
                bufferedStream.DiscardBufferedData();
            }

            inTransaction = false;
        }
        /// <summary>
        /// Creates the stream
        /// </summary>
        /// <param name="stream">Stream to wrap</param>
        public MasterStream(Stream stream, bool bufferData)
        {
            if (stream == null)
            {
                throw new ArgumentNullException("stream");
            }

            if (bufferData)
            {
                bufferStream = new WriteBufferedStream(stream, 512);
                this.stream  = bufferStream;
            }
            else
            {
                this.stream = stream;
            }
        }