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; }
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; }
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; }
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; }
public static Stream Serialize( IWireSerialization serialization, IRequestContext request, IResponseContext response, object result, ChunkedMemoryStream outputStream) { outputStream.Reset(); response.ContentType = serialization.Serialize(result, request.Accept, outputStream); response.ContentLength = outputStream.Position; outputStream.Position = 0; return outputStream; }