using System;
using System.IO;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Text;

namespace ms.aq.cview {
    /// <summary>
    /// Summary description for Admin.
    /// </summary>
    public class plotstream : System.Web.UI.Page {

        override protected void OnInit(EventArgs e) {
            InitializeComponent();
            base.OnInit(e);
        }

        private void InitializeComponent() {

            Response.ContentType = "image/png";
            Stream fs = null;
            if (Session["ISTREAM"] == null) {
                return;
            } else {
                fs = (Stream)Session["ISTREAM"];
                
                
            }
            byte[] buf = new byte[1024];
            int off = 0, read = 0;
            while (fs.CanRead) {
                read = off + buf.Length > fs.Length ? (int)fs.Length - off : buf.Length;
                read = fs.Read(buf, 0, read);
                if (read <= 0) break;
                Response.OutputStream.Write(buf, 0, read);
                off += read;
            }
 
        }

    }
}
