protected WriterBase(BoundConfigurationBase <T> config, object?context) { RowNumber = 0; Configuration = config; var options = Configuration.Options; var memPool = Configuration.MemoryPool; var writeSizeHint = options.WriteBufferSizeHint; Buffer = new MaxSizedBufferWriter(memPool, writeSizeHint); Context = context; // buffering is configurable if (writeSizeHint == 0) { HasStaging = false; Staging = EmptyMemoryOwner.Singleton; StagingMemory = Memory <char> .Empty; InStaging = -1; } else { HasStaging = true; Staging = memPool.Rent(writeSizeHint ?? MaxSizedBufferWriter.DEFAULT_STAGING_SIZE); StagingMemory = Staging.Memory; InStaging = 0; } IsFirstRow = true; Columns = Array.Empty <Column>(); WriteContexts = Array.Empty <WriteContext>(); }
protected WriterBase(BoundConfigurationBase <T> config, object context) { RowNumber = 0; Config = config; Buffer = new MaxSizedBufferWriter(Config.MemoryPool, config.WriteBufferSizeHint); Context = context; // buffering is configurable if (Config.WriteBufferSizeHint == 0) { Staging = null; InStaging = -1; } else { InStaging = 0; Staging = Config.MemoryPool.Rent(Config.WriteBufferSizeHint ?? MaxSizedBufferWriter.DEFAULT_STAGING_SIZE); } }