Exemplo n.º 1
0
        /// <summary>
        /// Default constructor.
        /// </summary>
        /// <param name="stream">Stream to wrap.</param>
        /// <param name="owner">Specifies if SmartStream is owner of <b>stream</b>.</param>
        /// <exception cref="ArgumentNullException">Is raised when <b>stream</b> is null.</exception>
        public SmartStream(Stream stream,bool owner)
        {
            if(stream == null){
                throw new ArgumentNullException("stream");
            }

            m_pStream = stream;
            m_IsOwner = owner;
            m_pReadBuffer = new byte[m_BufferSize];
            m_pReadBufferOP = new BufferReadAsyncOP(this);

            m_LastActivity = DateTime.Now;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Cleans up any resources being used.
        /// </summary>
        public new void Dispose()
        {
            if(m_IsDisposed){
                return;
            }
            m_IsDisposed = true;

            if(m_pReadBufferOP != null){
                m_pReadBufferOP.Dispose();
            }
            m_pReadBufferOP = null;

            if(m_IsOwner){
                m_pStream.Dispose();
            }
        }