public static void SerializeObject <T>(T value, Stream stream, Encoding encoding, JsonFormatterOptions options) { var hGCache = CharsPool.Rent(); SerializeObject(value, hGCache, options); hGCache.WriteTo(stream, encoding); CharsPool.Return(hGCache); }
/// <summary> /// 异步将 JSON 字符串反序列化到指定的数据写入器中。 /// </summary> /// <param name="textReader">JSON 字符串读取器</param> /// <param name="dataWriter">数据写入器</param> public async Task DeserializeToAsync(TextReader textReader, IDataWriter dataWriter) { var hGCache = CharsPool.Rent(); await hGCache.ReadFromAsync(textReader); DeserializeTo(hGCache, dataWriter); CharsPool.Return(hGCache); }
public async Task SerializeAsync <T>(T value, TextWriter textWriter) { var hGCache = CharsPool.Rent(); Serialize(value, hGCache); await hGCache.WriteToAsync(textWriter); CharsPool.Return(hGCache); }
public static async Task SerializeObjectAsync <T>(T value, Stream stream, Encoding encoding, JsonFormatterOptions options) { var hGCache = CharsPool.Rent(); SerializeObject(value, hGCache, options); await hGCache.WriteToAsync(stream, encoding); CharsPool.Return(hGCache); }
public async Task SerializeAsync <T>(T value, Stream stream, Encoding encoding) { var hGCache = CharsPool.Rent(); Serialize(value, hGCache); await hGCache.WriteToAsync(stream, encoding); CharsPool.Return(hGCache); }
public static async Task SerializeObjectAsync <T>(T value, TextWriter textWriter, JsonFormatterOptions options) { var hGCache = CharsPool.Rent(); SerializeObject(value, hGCache, options); await hGCache.WriteToAsync(textWriter); CharsPool.Return(hGCache); }
public static string SerializeObject <T>(T value) { var hGCache = CharsPool.Rent(); SerializeObject(value, hGCache); var str = hGCache.ToStringEx(); CharsPool.Return(hGCache); return(str); }
public static object DeserializeObject(Stream stream, Encoding encoding, Type type, JsonFormatterOptions options) { var hGCache = CharsPool.Rent(); hGCache.ReadFrom(stream, encoding); var value = DeserializeObject(hGCache, type, options); CharsPool.Return(hGCache); return(value); }
public static object DeserializeObject(TextReader textReader, Type type, JsonFormatterOptions options) { var hGCache = CharsPool.Rent(); hGCache.ReadFrom(textReader); var value = DeserializeObject(hGCache, type, options); CharsPool.Return(hGCache); return(value); }
public async Task <T> DeserializeAsync <T>(Stream stream, Encoding encoding) { var hGCache = CharsPool.Rent(); await hGCache.ReadFromAsync(stream, encoding); var value = Deserialize <T>(hGCache); CharsPool.Return(hGCache); return(value); }
public async Task <object> DeserializeAsync(TextReader textReader, Type type) { var hGCache = CharsPool.Rent(); await hGCache.ReadFromAsync(textReader); var value = Deserialize(hGCache, type); CharsPool.Return(hGCache); return(value); }
public static async Task <T> DeserializeObjectAsync <T>(Stream stream, Encoding encoding, JsonFormatterOptions options) { var hGCache = CharsPool.Rent(); await hGCache.ReadFromAsync(stream, encoding); var value = DeserializeObject <T>(hGCache); CharsPool.Return(hGCache); return(value); }
public static async Task <object> DeserializeObjectAsync(TextReader textReader, Type type, JsonFormatterOptions options) { var hGCache = CharsPool.Rent(); await hGCache.ReadFromAsync(textReader); var value = DeserializeObject(hGCache, type, options); CharsPool.Return(hGCache); return(value); }
public async Task <T> DeserializeAsync <T>(TextReader textReader) { var hGCache = CharsPool.Rent(); await hGCache.ReadFromAsync(textReader); var value = Deserialize <T>(hGCache); CharsPool.Return(hGCache); return(value); }
public static async Task <object> DeserializeObjectAsync(Stream stream, Encoding encoding, Type type) { var hGCache = CharsPool.Rent(); await hGCache.ReadFromAsync(stream, encoding); var value = DeserializeObject(hGCache, type); CharsPool.Return(hGCache); return(value); }
public static string SerializeObject <T>(T value, JsonFormatterOptions options) { var hGCache = CharsPool.Rent(); SerializeObject(value, hGCache, options); var str = hGCache.ToStringEx(); CharsPool.Return(hGCache); return(str); }
public static T DeserializeObject <T>(TextReader textReader) { var hGCache = CharsPool.Rent(); hGCache.ReadFrom(textReader); var value = DeserializeObject <T>(hGCache); CharsPool.Return(hGCache); return(value); }
public static T DeserializeObject <T>(Stream stream, Encoding encoding) { var hGCache = CharsPool.Rent(); hGCache.ReadFrom(stream, encoding); var value = DeserializeObject <T>(hGCache); CharsPool.Return(hGCache); return(value); }
public static IJsonReader CreateJsonReader(Stream stream, Encoding encoding) { var hGCache = CharsPool.Rent(); hGCache.ReadFrom(stream, encoding); var jsonReader = CreateJsonReader(hGCache); CharsPool.Return(hGCache); return(jsonReader); }
public static IJsonReader CreateJsonReader(TextReader textReader) { var hGCache = CharsPool.Rent(); hGCache.ReadFrom(textReader); var jsonReader = CreateJsonReader(hGCache); CharsPool.Return(hGCache); return(jsonReader); }
public static void SerializeObject <T>(T value, TextWriter textWriter, JsonFormatterOptions options) { var hGCache = CharsPool.Rent(); if ((options & ReferenceOptions) != 0) { var jsonSerializer = new JsonSerializer <JsonSerializeModes.ReferenceMode>(options, hGCache, DefaultMaxDepth) { References = new JsonReferenceWriter() }; if ((options & JsonFormatterOptions.Indented) != 0) { jsonSerializer.IndentedChars = DefaultIndentedChars; jsonSerializer.LineBreakChars = DefaultLineCharsBreak; jsonSerializer.MiddleChars = DefaultMiddleChars; } ValueInterface <T> .WriteValue(jsonSerializer, value); jsonSerializer.Flush(); } else if ((options & ComplexOptions) != 0) { var jsonSerializer = new JsonSerializer <JsonSerializeModes.ComplexMode>(options, hGCache, DefaultMaxDepth); if ((options & JsonFormatterOptions.Indented) != 0) { jsonSerializer.IndentedChars = DefaultIndentedChars; jsonSerializer.LineBreakChars = DefaultLineCharsBreak; jsonSerializer.MiddleChars = DefaultMiddleChars; } ValueInterface <T> .WriteValue(jsonSerializer, value); jsonSerializer.Flush(); } else { var jsonSerializer = new JsonSerializer <DefaultSerializeMode>(options, hGCache, DefaultMaxDepth); ValueInterface <T> .WriteValue(jsonSerializer, value); jsonSerializer.Flush(); } hGCache.WriteTo(textWriter); CharsPool.Return(hGCache); }
public static void SerializeObject <T>(T value, TextWriter textWriter) { var hGCache = CharsPool.Rent(); var jsonSerializer = new JsonSerializer <DefaultSerializeMode>(hGCache, DefaultMaxDepth) { textWriter = textWriter }; ValueInterface <T> .WriteValue(jsonSerializer, value); jsonSerializer.Flush(); hGCache.WriteTo(textWriter); CharsPool.Return(hGCache); }