コード例 #1
0
        /// <summary>
        /// Constructs a new checksum generating stream
        /// </summary>
        /// <param name="signatureOutput">The stream into which signature data is written</param>
        /// <param name="inputData">The source data stream</param>
        public ChecksumGeneratingStream(System.IO.Stream signatureOutput, System.IO.Stream inputData)
        {
            if (!signatureOutput.CanWrite)
                throw new ArgumentException("signatureOutput");
            if (!inputData.CanRead)
                throw new ArgumentException("inputData");

            m_outstream = new ChecksumFileWriter(signatureOutput);
            m_basestream = inputData;

            m_checksumBuffer = new byte[m_outstream.BlockLength];
            m_checksumBufferIndex = 0;
        }
コード例 #2
0
        public override void Flush()
        {
            if (m_basestream != null)
            {
                m_basestream.Dispose();
                if (m_checksumBufferIndex != 0)
                    m_outstream.AddChunk(m_checksumBuffer, 0, m_checksumBufferIndex);
            }

            m_outstream = null;
            m_basestream = null;
        }