public void ReadData(IObjectDataInput input)
        {
            var len = input.ReadInt();

            _data = new byte[len];
            input.ReadBytes(_data);
        }
Exemplo n.º 2
0
        public CustomSerializableType Read(IObjectDataInput input)
        {
            var len   = input.ReadInt();
            var array = new byte[len];

            input.ReadBytes(array);
            return(new CustomSerializableType {
                Value = Encoding.UTF8.GetString(array)
            });
        }
        public Person Read(IObjectDataInput input)
        {
            var bf  = new BinaryFormatter();
            var len = input.ReadInt();

            var buffer = new byte[len];

            input.ReadBytes(buffer);

            using var ms = new MemoryStream(buffer);
            return((Person)bf.Deserialize(ms));
        }
        public CustomSerializableType Read(IObjectDataInput input)
        {
            var bf  = new BinaryFormatter();
            var len = input.ReadInt();

            var buffer = new byte[len];

            input.ReadBytes(buffer);

            CustomSerializableType result = null;

            using (var ms = new MemoryStream(buffer))
            {
                result = (CustomSerializableType)bf.Deserialize(ms);
            }
            return(result);
        }