private static extern IntPtr ManagedOutputStream_Create(
     WriteDelegate write,
     TellDelegate tell,
     FlushDelegate flush,
     CloseDelegate close,
     ClosedDelegate closed,
     out IntPtr outputStream);
示例#2
0
 /// <summary>
 /// 释放由 System.IO.Stream 占用的非托管资源,还可以另外再释放托管资源。
 /// </summary>
 /// <param name="disposing">为 true,则释放托管资源和非托管资源;为 false,则仅释放非托管资源。</param>
 protected override void Dispose(bool disposing)
 {
     base.Dispose(disposing);
     if (disposing)
     {
         _writeAction = null;
         _flushAction = null;
     }
 }
 private static ParquetHandle Create(
     WriteDelegate write,
     TellDelegate tell,
     FlushDelegate flush,
     CloseDelegate close,
     ClosedDelegate closed)
 {
     ExceptionInfo.Check(ManagedOutputStream_Create(write, tell, flush, close, closed, out var handle));
     return(new ParquetHandle(handle, OutputStream_Free));
 }
示例#4
0
 //--- Constructors ---
 public AutoFlushContainer(T initialState, FlushDelegate flush, int maxUpdates, TimeSpan autoFlushDelay, TaskTimerFactory timerFactory)
 {
     if (flush == null)
     {
         throw new ArgumentNullException("flush");
     }
     if (maxUpdates <= 0)
     {
         throw new ArgumentException("maxItems must be positive", "maxUpdates");
     }
     if (autoFlushDelay <= TimeSpan.Zero)
     {
         throw new ArgumentException("maxDelay must be positive", "autoFlushDelay");
     }
     _state          = initialState;
     _flush          = flush;
     _maxUpdates     = maxUpdates;
     _autoFlushDelay = autoFlushDelay;
     _autoFlushTimer = timerFactory.New(DateTime.MaxValue, AutoFlushCallback, null, TaskEnv.None);
 }
示例#5
0
        public static void ProcessClientBigRequest(string ConnString, Stream requestStream, Stream responseStream, bool dispose, FlushDelegate flushDelegate, TaskLoggingHelper log)
        {
            XmlTextReader xr = new XmlTextReader(requestStream);

            XmlTextWriter xw = new XmlTextWriter(responseStream, Encoding.UTF8);

            xw.WriteStartDocument();
            xw.WriteStartElement("table");

            bool first = true;

            //using (xr)
            //{
                xr.Read();
                xr.Read();
                xr.ReadStartElement("request");
                while (xr.Name == "id")
                {
                    int serviceTableID = Convert.ToInt32(xr.ReadElementString("id"));
                    ServiceTable st = DAO.GetServiceTable(ConnString, serviceTableID);
                    if (first)
                    {
                        if (log != null)
                            log.LogMessage("Processing ID " + serviceTableID.ToString() + " response " + st.ServiceTableID.ToString());
                        first = false;
                    }

                    xw.WriteStartElement("record");
                    xw.WriteElementString("ServiceTableID", st.ServiceTableID.ToString());
                    xw.WriteElementString("DescServiceTable", st.DescServiceTable);
                    xw.WriteElementString("Value", st.Value.ToString("0.00"));
                    xw.WriteElementString("CreationDate", st.CreationDate.ToString("dd/MM/yyyy hh:mm:ss"));
                    xw.WriteElementString("StringField1", st.StringField1);
                    xw.WriteElementString("StringField2", st.StringField2);
                    xw.WriteEndElement();
                    if (flushDelegate != null)
                        flushDelegate();
                }
                xr.ReadEndElement();

            //}
                xr.Dispose();
            xw.WriteEndElement();
            xw.Flush();

            if (dispose)
                xw.Close();
        }
示例#6
0
 public static void ProcessClientBigRequest(string ConnString, Stream requestStream, Stream responseStream, bool dispose, FlushDelegate flushDelegate)
 {
     StreamUtil.ProcessClientBigRequest(ConnString, requestStream, responseStream, dispose, flushDelegate, null);
 }
示例#7
0
 /// <summary>
 /// 创建HttpOutputStream实例。
 /// </summary>
 /// <param name="writeAction">写入流委托。</param>
 /// <param name="flushAction">Flush流委托。</param>
 public HttpOutputStream(WriteDelegate writeAction, FlushDelegate flushAction)
 {
     _writeAction = writeAction;
     _flushAction = flushAction;
 }