Table of Contents

Struct CsvIOOptions

Namespace
FlameCsv.IO
Assembly
FlameCsv.Core.dll

Represents options for configuring ICsvBufferReader<T> and ICsvBufferWriter<T>.

public readonly record struct CsvIOOptions : IEquatable<CsvIOOptions>
Implements

Fields

DefaultBufferSize

The default buffer size (16 KiB).

public const int DefaultBufferSize = 16384

Field Value

int
See Also

DefaultFileBufferSize

The default buffer size when doing file I/O (64 KiB).
This is used with the file I/O methods in Csv. if BufferSize is not explicitly configured.

public const int DefaultFileBufferSize = 65536

Field Value

int
See Also

DefaultMinimumReadSize

The default minimum read size (1 KiB).
This is used when the minimum read size is not explicitly configured.

public const int DefaultMinimumReadSize = 1024

Field Value

int
See Also

MinimumBufferSize

The minimum buffer size, values below this will be clamped.

public const int MinimumBufferSize = 256

Field Value

int

Properties

BufferPool

Gets or sets the buffer pool used for renting buffers.
The default is null, which uses Shared.

public IBufferPool? BufferPool { get; init; }

Property Value

IBufferPool

BufferSize

Gets or sets the buffer size to use when working with streaming I/O. This value may be ignored when reading constant data such as ReadOnlyMemory<T>.
If set to -1, the default buffer size is used.
This value will be clamped to be at minimum MinimumBufferSize.

public int BufferSize { get; init; }

Property Value

int

Remarks

This is only the initial value; the buffer may be resized during reading if needed.
If unset, either DefaultBufferSize or DefaultFileBufferSize will be used depending on the context.

Exceptions

ArgumentOutOfRangeException

Thrown if the value is negative or zero and not -1.

See Also

DisableOptimizations

Disables direct buffer reading optimization when reading MemoryStream or StringReader with an exposable buffer.
Disables custom UTF8-specialisations that are used instead of a StreamReader and StreamWriter when working with streams with UTF8 encoding.
The default is false.

public bool DisableOptimizations { get; init; }

Property Value

bool

LeaveOpen

Gets or sets a value indicating whether the inner stream/reader should be left open after use.
The default is false.

public bool LeaveOpen { get; init; }

Property Value

bool

Remarks

This parameter is ignored if the stream was not created by the library, such as when writing to a file.

See Also

MinimumReadSize

Gets or sets the minimum available data size when reading from streaming sources. This value may be ignored when reading constant data such as ReadOnlyMemory<T>.
If unset or set to -1, the smaller of DefaultMinimumReadSize and BufferSize / 2 will be used.

public int MinimumReadSize { get; init; }

Property Value

int

Remarks

This threshold determines when the next read operation is performed to fill the buffer. It should generally be set to a large enough value that it fits at least a single complete CSV record, but small enough compared to BufferSize to not needlessly perform I/O if there are unread records.

Exceptions

ArgumentOutOfRangeException

Thrown if the value is negative or zero and not -1.

See Also

Methods

ForFileIO()

Returns a copy of the options with file I/O specific settings applied:

public CsvIOOptions ForFileIO()

Returns

CsvIOOptions

See Also