/// <inheritdoc />
        public byte[] Serialize <T>(T @object)
        {
            if (@object == null)
            {
                throw new ArgumentNullException(nameof(@object));
            }

            return(_options.UseLz4Compression
                ? LZ4MessagePackSerializer.Serialize(@object, _options.FormatterResolver)
                : NeueccMessagePackSerializer.Serialize(@object, _options.FormatterResolver));
        }
 protected override TV InternalDeserialize <TV>(Stream stream) =>
 Mps.Deserialize <TV>(stream);
Beispiel #3
0
        static ArraySegment <byte> SerializeCore <T>(T obj, IFormatterResolver resolver)
        {
            var serializedData = MessagePackSerializer.SerializeUnsafe(obj, resolver);

            return(ToLZ4BinaryCore(serializedData));
        }
        /// <summary>
        ///     From Json String to LZ4MessagePack binary
        /// </summary>
        public static byte[] FromJson(TextReader reader)
        {
            var buffer = MessagePackSerializer.FromJsonUnsafe(reader); // offset is guranteed from 0

            return(ToLZ4Binary(buffer));
        }
 public Typeless(MessagePackSerializer serializer)
 {
     this.serializer = serializer ?? throw new ArgumentNullException(nameof(serializer));
 }