Beispiel #1
0
        /// <summary>
        /// Called when FlatSharp has finished a serialize operation. This is the signal to flush any strings that the
        /// string writer is hanging onto.
        /// </summary>
        public void FlushWrites(SpanWriter writer, Span <byte> data, SerializationContext context)
        {
            foreach (var kvp in this.stringOffsetMap)
            {
                SharedString str     = kvp.Key;
                List <int>   offsets = kvp.Value;

                // Write the string.
                int stringOffset = writer.WriteAndProvisionString(data, str, context);

                // Update all the pointers that need to point to that string.
                foreach (var offset in offsets)
                {
                    writer.WriteUOffset(data, offset, stringOffset, context);
                }
            }
        }