From 5ddef0fcb742e77b99a0e17015d2eea0a1d4131a Mon Sep 17 00:00:00 2001 From: vnugent Date: Thu, 9 Mar 2023 01:48:28 -0500 Subject: Omega cache, session, and account provider complete overhaul --- lib/Utils/src/VnEncoding.cs | 64 ++------------------------------------------- 1 file changed, 2 insertions(+), 62 deletions(-) (limited to 'lib/Utils/src/VnEncoding.cs') diff --git a/lib/Utils/src/VnEncoding.cs b/lib/Utils/src/VnEncoding.cs index 89863aa..c9cdbb0 100644 --- a/lib/Utils/src/VnEncoding.cs +++ b/lib/Utils/src/VnEncoding.cs @@ -74,67 +74,7 @@ namespace VNLib.Utils throw; } } - - /// - /// Attempts to deserialze a json object from a stream of UTF8 data - /// - /// The type of the object to deserialize - /// Binary data to read from - /// object to pass to deserializer - /// The object decoded from the stream - /// - /// - public static T? JSONDeserializeFromBinary(Stream? data, JsonSerializerOptions? options = null) - { - //Return default if null - if (data == null) - { - return default; - } - //Create a memory stream as a buffer - using VnMemoryStream ms = new(); - //Copy stream data to memory - data.CopyTo(ms, null); - if (ms.Length > 0) - { - //Rewind - ms.Position = 0; - //Recover data from stream - return ms.AsSpan().AsJsonObject(options); - } - //Stream is empty - return default; - } - /// - /// Attempts to deserialze a json object from a stream of UTF8 data - /// - /// Binary data to read from - /// - /// object to pass to deserializer - /// The object decoded from the stream - /// - /// - public static object? JSONDeserializeFromBinary(Stream? data, Type type, JsonSerializerOptions? options = null) - { - //Return default if null - if (data == null) - { - return default; - } - //Create a memory stream as a buffer - using VnMemoryStream ms = new(); - //Copy stream data to memory - data.CopyTo(ms, null); - if (ms.Length > 0) - { - //Rewind - ms.Position = 0; - //Recover data from stream - return JsonSerializer.Deserialize(ms.AsSpan(), type, options); - } - //Stream is empty - return default; - } + /// /// Attempts to deserialze a json object from a stream of UTF8 data /// @@ -315,7 +255,7 @@ namespace VNLib.Utils //Fill remaining bytes with padding chars for(; rounds < 8; rounds++) { - //Append trailing '=' + //Append trailing '=' padding character writer.Append('='); } } -- cgit