Exemplo n.º 1
0
        /// <summary>
        /// Deserializes an object from a FlatBuffer formatted byte array
        /// </summary>
        /// <param name="type">The type of the object to deserialize</param>
        /// <param name="buffer">Buffer containing FlatBuffer data</param>
        /// <param name="offset">Offset into the buffer to start reading from</param>
        /// <param name="count">The number of available bytes to read</param>
        /// <returns>Deserialized object of type T</returns>
        public static object DeserializeObject(Type type, byte[] buffer, int offset, int count)
        {
            var serializer = new FlatBuffersSerializer();

            return(serializer.Deserialize(type, buffer, offset, count));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Deserializes an object from a FlatBuffer formatted byte array
        /// </summary>
        /// <param name="type">The type of the object to deserialize</param>
        /// <param name="buffer">Buffer containing FlatBuffer data</param>
        /// <returns>Deserialized object of type T</returns>
        public static object DeserializeObject(Type type, byte[] buffer)
        {
            var serializer = new FlatBuffersSerializer();

            return(serializer.Deserialize(type, buffer, 0, buffer.Length));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Serializes an object into a FlatBuffer formatted byte array
        /// </summary>
        /// <param name="obj">Object to serialize</param>
        /// <returns>A sized byte buffer containing the flatbuffer data</returns>
        public static byte[] SerializeObject(object obj)
        {
            var serializer = new FlatBuffersSerializer();

            return(serializer.Serialize(obj));
        }