当前位置: 首页>>代码示例>>C#>>正文


C# TextWriter.Flush方法代码示例

本文整理汇总了C#中System.IO.TextWriter.Flush方法的典型用法代码示例。如果您正苦于以下问题:C# TextWriter.Flush方法的具体用法?C# TextWriter.Flush怎么用?C# TextWriter.Flush使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.IO.TextWriter的用法示例。


在下文中一共展示了TextWriter.Flush方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Escher

        /**
         * Constructor
         *
         * @param w The workbook to interrogate
         * @param out The output stream to which the CSV values are written
         * @param encoding The encoding used by the output stream.  Null or
         * unrecognized values cause the encoding to default to UTF8
         * @exception java.io.IOException
         */
        public Escher(Workbook w, TextWriter os, string encoding)
        {
            if (encoding == null || encoding == "UnicodeBig")
                {
                encoding = "UTF8";
                }

            try
                {
                for (int i = 0; i < w.getNumberOfSheets(); i++)
                    {
                    SheetImpl s = (SheetImpl)w.getSheet(i);
                    os.Write(s.getName());
                    os.WriteLine();
                    os.WriteLine();

                    DrawingData dd = s.getDrawingData();

                    if (dd != null)
                        {
                        EscherDisplay ed = new EscherDisplay(dd, os);
                        ed.display();
                        }

                    os.WriteLine();
                    os.WriteLine();
                    os.Flush();
                    }
                os.Flush();
                }
            catch (Exception e)
                {
                Console.WriteLine(e);
                }
        }
开发者ID:advdig,项目名称:advgp2_administracion,代码行数:44,代码来源:Escher.cs

示例2: print

	/**
	 * Prettyprint the object to the outputstream.
	 */
	public static void print(object o, TextWriter w, bool typeheader) {
		if (o == null) {
			if(typeheader) w.WriteLine("null object");
			w.WriteLine("null");
			w.Flush();
			return;
		}

		if (o is IDictionary) {
			if(typeheader) w.WriteLine("hashtable");
			IDictionary map=(IDictionary)o;
			w.Write("{");
			foreach(object key in map.Keys) {
				w.Write(key.ToString()+"="+map[key].ToString()+", ");
			}
			w.WriteLine("}");
		} else if (o is string) {
			if(typeheader) w.WriteLine("String");
			w.WriteLine(o.ToString());
		} else if (o is DateTime) {
			if(typeheader) w.WriteLine("DateTime");
			w.WriteLine((DateTime)o);
		} else if (o is IEnumerable) {
			if(typeheader) w.WriteLine(o.GetType().Name);
			writeEnumerable(o, w);
			w.WriteLine("");
		} else {
			if(typeheader) w.WriteLine(o.GetType().Name);
			w.WriteLine(o.ToString());
		}
		
		w.Flush();
	}
开发者ID:davies,项目名称:Pyrolite,代码行数:36,代码来源:PrettyPrint.cs

示例3: TextNullTextWriter

        public static void TextNullTextWriter(TextWriter output)
        {
            output.Flush();
            output.Dispose();

            output.WriteLine(decimal.MinValue);
            output.WriteLine(Math.PI);
            output.WriteLine();
            output.Flush();
            output.Dispose();
        }
开发者ID:neris,项目名称:corefx,代码行数:11,代码来源:Stream.NullTests.cs

示例4: Emit

        public override void Emit(TextWriter outputWriter)
        {

            if(TableNavigator.Select("rc:DefaultValues/rc:Value",VulcanPackage.VulcanConfig.NamespaceManager).Count == 0)
            {
                outputWriter.Flush();
                return;
            }

            StringBuilder columnBuilder = new StringBuilder();

            bool containsIdentities = _tableHelper.KeyColumnType == KeyColumnType.Identity;
            foreach (XPathNavigator nav in TableNavigator.Select("rc:Columns/rc:Column", VulcanPackage.VulcanConfig.NamespaceManager))
            {
                /* Build Column List */
                string columnName = nav.SelectSingleNode("@Name", VulcanPackage.VulcanConfig.NamespaceManager).Value;

                columnBuilder.AppendFormat(
                     "[{0}],",
                     columnName
                 );
            }

            columnBuilder.Remove(columnBuilder.Length - 1, 1);

            if (containsIdentities)
            {
                outputWriter.Write("\n");
                outputWriter.Write(String.Format(System.Globalization.CultureInfo.InvariantCulture,"\nSET IDENTITY_INSERT {0} ON\n", TableName));
            }
            TemplateEmitter te = new TemplateEmitter("InsertDefaultValues",VulcanPackage,null);

            outputWriter.Write("\n");
            foreach (XPathNavigator nav in TableNavigator.Select("rc:DefaultValues/rc:Value", VulcanPackage.VulcanConfig.NamespaceManager))
            {
                te.SetParameters(TableName, columnBuilder.ToString(),nav.Value);
                te.Emit(outputWriter);
                outputWriter.Write("\n"); ;
            }

            if (containsIdentities)
            {
                outputWriter.Write(String.Format(System.Globalization.CultureInfo.InvariantCulture,"\nSET IDENTITY_INSERT {0} OFF", TableName));
            }

            outputWriter.Write("\nGO\n");
            outputWriter.Flush();
        }
开发者ID:japj,项目名称:vulcan,代码行数:48,代码来源:InsertDefaultValuesEmitter.cs

示例5: saveVolume

        /// <summary>
        /// Primary constructor
        /// </summary>
        public saveVolume(string u, string p)
        {
            m_username = u;
            m_password = p;
   
            OutputFolder = TA.DirectoryNames.GetDirectoryName(ext: "ttapiContractVolume") + 
                TA.DirectoryNames.GetDirectoryExtension(DateTime.Now.Date);
            System.IO.Directory.CreateDirectory(OutputFolder);

            ilsUpdateList = new List<EventHandler<InstrumentLookupSubscriptionEventArgs>>();

            sw = new StreamWriter(OutputFolder + "/ContractList.csv");

            sw.WriteLine("{0},{1},{2},{3},{4}", "InstrumentName",
                        "MarketKey",
                        "ProductType",
                        "ProductName",
                        "Volume");

            sw.Flush();

            TTAPISubs = new ttapiUtils.Subscription(m_username, m_password);

            IlsDictionary = TTAPISubs.IlsDictionary;
            
            TTAPISubs.asu_update = TTAPISubs.startProductLookupSubscriptions;
            TTAPISubs.PLSEventHandler = TTAPISubs.Subscribe2InstrumentCatalogs;
            TTAPISubs.ICUEventHandler = TTAPISubs.StartInstrumentLookupSubscriptionsFromCatalog;

            ilsUpdateList.Add(TTAPISubs.startPriceSubscriptions);
            TTAPISubs.priceUpdatedEventHandler = WriteVolume2File;

            TTAPISubs.ilsUpdateList = ilsUpdateList;

        }
开发者ID:chitown2016,项目名称:repo_barbarossa,代码行数:38,代码来源:saveVolume.cs

示例6: WriteCurrentLineToFile

 /// <summary>
 /// Writes the current line to the file using the given open text writer.
 /// This clears the current line after writing.
 /// </summary>
 public void WriteCurrentLineToFile( TextWriter writer )
 {
     line = line.TrimEnd( delimiter );
     writer.WriteLine( line );
     writer.Flush();
     line = "";
 }
开发者ID:enduracode,项目名称:enterprise-web-library,代码行数:11,代码来源:TabDelimitedFileWriter.cs

示例7: GenerateResult

		public static void GenerateResult (TextReader sr, TextWriter sw, Uri baseUri)
		{
			while (sr.Peek () > 0) {
				string uriString = sr.ReadLine ();
				if (uriString.Length == 0 || uriString [0] == '#')
					continue;
				Uri uri = (baseUri == null) ?
					new Uri (uriString) : new Uri (baseUri, uriString);

				sw.WriteLine ("-------------------------");
				sw.WriteLine (uriString);
				sw.WriteLine (uri.ToString ());
				sw.WriteLine (uri.AbsoluteUri);
				sw.WriteLine (uri.Scheme);
				sw.WriteLine (uri.Host);
				sw.WriteLine (uri.LocalPath);
				sw.WriteLine (uri.Query);
				sw.WriteLine (uri.Port);
				sw.WriteLine (uri.IsFile);
				sw.WriteLine (uri.IsUnc);
				sw.WriteLine (uri.IsLoopback);
				sw.WriteLine (uri.UserEscaped);
				sw.WriteLine (uri.HostNameType);
				sw.WriteLine (uri.AbsolutePath);
				sw.WriteLine (uri.PathAndQuery);
				sw.WriteLine (uri.Authority);
				sw.WriteLine (uri.Fragment);
				sw.WriteLine (uri.UserInfo);
				sw.Flush ();
			}
			sr.Close ();
			sw.Close ();
		}
开发者ID:nlhepler,项目名称:mono,代码行数:33,代码来源:uri-test-generator.cs

示例8: LogTextWriter

 public LogTextWriter(string filePath, string prefix = null, string suffix = null, string newline = "\n")
 {
     _outputQueue = new ConcurrentQueue<string>();
     _outputRun = 1;
     _outputThread = new Thread(() =>
     {
         string o;
             using (FileStream _fs = File.Open(filePath, FileMode.Create, FileAccess.ReadWrite, FileShare.Read))
             {
         _innerWriter = new StreamWriter(_fs);
         _innerWriter.NewLine = newline;
         while (Thread.VolatileRead(ref _outputRun) == 1 || _outputQueue.Count > 0)
         {
             if (_outputQueue.Count > 0)
             {
                 while (_outputQueue.TryDequeue(out o))
                     _innerWriter.Write(o);
                 _innerWriter.Flush();
             }
             else
                 Thread.Sleep(_outputThreadDelay);
         }
     //				_fs.Close();
         _innerWriter.Close();
             }
     });
     _outputThread.Priority = ThreadPriority.BelowNormal;
     _outputThread.Start();
     _prefix = prefix;
     _suffix = suffix;
 }
开发者ID:jbowwww,项目名称:ArtefactService,代码行数:31,代码来源:LogTextWriter.cs

示例9: EscherDrawingGroup

        /**
         * Constructor
         *
         * @param w The workbook to interrogate
         * @param out The output stream to which the CSV values are written
         * @param encoding The encoding used by the output stream.  Null or
         * unrecognized values cause the encoding to default to UTF8
         * @exception java.io.IOException
         */
        public EscherDrawingGroup(Workbook w, TextWriter os, string encoding)
        {
            if (encoding == null || encoding != "UnicodeBig")
                {
                encoding = "UTF8";
                }

            try
                {
                WorkbookParser wp = (WorkbookParser)w;

                DrawingGroup dg = wp.getDrawingGroup();

                if (dg != null)
                    {
                    EscherDisplay ed = new EscherDisplay(dg, os);
                    ed.display();
                    }

                os.WriteLine();
                os.WriteLine();
                os.Flush();
                }
            catch (Exception e)
                {
                Console.WriteLine(e);
                }
        }
开发者ID:advdig,项目名称:advgp2_administracion,代码行数:37,代码来源:EscherDrawingGroup.cs

示例10: Render

        /// <summary>
        /// Renders the view into the given <see cref="TextWriter"/>.
        /// </summary>
        /// <param name="viewContext">Contains the view data model.</param>
        /// <param name="writer">The <see cref="TextWriter"/> used to write the rendered output.</param>
        public void Render(ViewContext viewContext, TextWriter writer)
        {
            var content = Razor.Parse(_template, viewContext.ViewData.Model, _resourcePath);

            writer.Write(content);
            writer.Flush();
        }
开发者ID:vip32,项目名称:postal,代码行数:12,代码来源:ResourceRazorView.cs

示例11: Render

        public void Render(ViewContext viewContext, TextWriter writer)
        {
            var content = Razor.Parse(template, viewContext.ViewData.Model, cacheName);

            writer.Write(content);
            writer.Flush();
        }
开发者ID:ryanbakernz,项目名称:postal,代码行数:7,代码来源:FileSystemRazorView.cs

示例12: Evaluate

        public void Evaluate(IDictionary<string, object> context, TextReader input, TextWriter output)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            if (input == null)
            {
                throw new ArgumentNullException("input");
            }

            if (output == null)
            {
                throw new ArgumentNullException("output");
            }

            var vctx = this.CreateVelocityContext(context);

            //执行渲染
            var successed = this.engine.Evaluate(vctx, output, "VelocityTextTemplateEngine", input);
            output.Flush();

            if (!successed)
            {
                throw new TemplateException("Failed to render template");
            }
        }
开发者ID:oldrev,项目名称:maltreport,代码行数:28,代码来源:VelocityTextTemplateEngine.cs

示例13: Save

        public void Save(IGraph g, TextWriter output)
        {
            JToken flattened = MakeExpandedForm(g);

            output.Write(flattened);
            output.Flush();
        }
开发者ID:rvesse,项目名称:NuGet.Services.Metadata,代码行数:7,代码来源:JsonLdWriter.cs

示例14: Save

        public void Save(IGraph g, TextWriter output)
        {
            JToken flattened = MakeExpandedForm(g);

            output.Write(flattened.ToString(Formatting.None, new JsonConverter[0]));
            output.Flush();
        }
开发者ID:NuGet,项目名称:NuGet.Services.Metadata,代码行数:7,代码来源:JsonLdWriter.cs

示例15: WriteToStream

 public static void WriteToStream(TextWriter stream, DataTable table, bool header, bool quoteall)
 {
     if (header)
     {
         for (int i = 0; i < table.Columns.Count; i++)
         {
             WriteItem(stream, table.Columns[i].Caption, quoteall);
             if (i < table.Columns.Count - 1)
                 stream.Write(',');
             else
                 stream.Write("\r\n");
         }
     }
     foreach (DataRow row in table.Rows)
     {
         for (int i = 0; i < table.Columns.Count; i++)
         {
             WriteItem(stream, row[i], quoteall);
             if (i < table.Columns.Count - 1)
                 stream.Write(',');
             else
                 stream.Write("\r\n");
         }
     }
     stream.Flush();
     stream.Close();
 }
开发者ID:huinalam,项目名称:6planets-project,代码行数:27,代码来源:Program.cs


注:本文中的System.IO.TextWriter.Flush方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。