コード例 #1
0
 public static Offset <SerializerCore.Serializers.BookShelfFlat> CreateBookShelfFlat(FlatBufferBuilder builder,
                                                                                     VectorOffset BooksOffset  = default(VectorOffset),
                                                                                     StringOffset SecretOffset = default(StringOffset))
 {
     builder.StartTable(2);
     BookShelfFlat.AddSecret(builder, SecretOffset);
     BookShelfFlat.AddBooks(builder, BooksOffset);
     return(BookShelfFlat.EndBookShelfFlat(builder));
 }
コード例 #2
0
        protected override BookShelfFlat Deserialize(Stream stream)
        {
            MemoryStream mem = new MemoryStream();

            // Since flatbuffers do not support memory streams we have to copy here
            stream.CopyTo(mem);
            byte[] data      = mem.ToArray();
            var    bookShelf = BookShelfFlat.GetRootAsBookShelfFlat(new ByteBuffer(data));

            return(bookShelf);
        }
コード例 #3
0
 protected override void Serialize(BookShelfFlat obj, Stream stream)
 {
     stream.Write(obj.ByteBuffer.ToFullArray(), obj.ByteBuffer.Position, obj.ByteBuffer.Length - obj.ByteBuffer.Position);
 }
コード例 #4
0
 public static BookShelfFlat GetRootAsBookShelfFlat(ByteBuffer _bb, BookShelfFlat obj)
 {
     return(obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb));
 }