GetWriter() 공개 메소드

Reuse same text writer on this stream.
public GetWriter ( ) : TextWriter
리턴 System.IO.TextWriter
예제 #1
0
		public static void Serialize(this IJsonObject instance, ChunkedMemoryStream stream)
		{
			stream.Reset();
			var sw = stream.GetWriter();
			instance.Serialize(sw, false, null);
			sw.Flush();
			stream.Position = 0;
		}
예제 #2
0
        /// <summary>
        /// Create reusable stream.
        /// Disposing the stream only has the effect of resetting it.
        /// </summary>
        /// <returns></returns>
        public static ChunkedMemoryStream Static()
        {
            var cms = new ChunkedMemoryStream(new byte[BlockSize]);

            cms.GetReader();
            cms.GetWriter();
            cms.UseBufferedReader(string.Empty);
            return(cms);
        }
예제 #3
0
        public IDbCommand CreateQuery(Revenj.Utility.ChunkedMemoryStream cms)
        {
            var writer = cms.GetWriter();

            writer.Write(Statement);
            writer.Flush();
            cms.Position = 0;
            return(PostgresCommandFactory.NewCommand(cms, Statement, Query.Selects.Count == 1));
        }
예제 #4
0
		public Context(IServiceProvider service)
		{
			Stream = ChunkedMemoryStream.Static();
			Writer = Stream.GetWriter();
			var dqm = service.Resolve<IDatabaseQueryManager>();
			var factory = service.Resolve<IObjectFactory>().CreateInnerFactory();
			factory.RegisterInterfaces(dqm.StartQuery(false));
			Repository = factory.Resolve<IPersistableRepository<World>>();
			BulkReader = factory.BulkRead(ChunkedMemoryStream.Static());
		}
예제 #5
0
		public static void Serialize(this IList<IJsonObject> values, ChunkedMemoryStream stream)
		{
			stream.Reset();
			var sw = stream.GetWriter();
			sw.Write('[');
			if (values.Count > 0)
			{
				values[0].Serialize(sw, false, null);
				for (int i = 1; i < values.Count; i++)
				{
					sw.Write(',');
					values[i].Serialize(sw, false, null);
				}
			}
			sw.Write(']');
			sw.Flush();
			stream.Position = 0;
		}
예제 #6
0
		public static void Serialize(this IJsonObject[] array, ChunkedMemoryStream stream, int len)
		{
			stream.Reset();
			var sw = stream.GetWriter();
			sw.Write('[');
			if (len > 0)
			{
				array[0].Serialize(sw, false, null);
				for (int i = 1; i < len; i++)
				{
					sw.Write(',');
					array[i].Serialize(sw, false, null);
				}
			}
			sw.Write(']');
			sw.Flush();
			stream.Position = 0;
		}
예제 #7
0
		/// <summary>
		/// Create reusable stream.
		/// Disposing the stream only has the effect of resetting it.
		/// </summary>
		/// <returns></returns>
		public static ChunkedMemoryStream Static()
		{
			var cms = new ChunkedMemoryStream(new byte[BlockSize]);
			cms.GetReader();
			cms.GetWriter();
			cms.UseBufferedReader(string.Empty);
			return cms;
		}
예제 #8
0
 public static Stream Render(IHtmlView html, IResponseContext response, ChunkedMemoryStream stream)
 {
     stream.Reset();
     response.ContentType = "text/html; charset=UTF-8";
     var sw = stream.GetWriter();
     html.Render(sw);
     sw.Flush();
     response.ContentLength = stream.Position;
     stream.Position = 0;
     return stream;
 }