Class Csv
Contains helper methods for CSV processing.
Inherited Members
Namespace: Cursively
Assembly: Cursively.dll
Syntax
[Obsolete("ProcessFoo methods have been moved to instance methods on dedicated 'input' types for better composability.")]
public static class Csv
Methods
| Improve this Doc View SourceProcessFile(String, CsvReaderVisitorBase)
Describes the entire contents of a CSV file to the given instance of the CsvReaderVisitorBase class.
Declaration
[Obsolete("Use CsvSyncInput.ForMemoryMappedFile(csvFilePath).Process(visitor).")]
public static void ProcessFile(string csvFilePath, CsvReaderVisitorBase visitor)
Parameters
Type | Name | Description |
---|---|---|
String | csvFilePath | The path to the CSV file to describe. |
CsvReaderVisitorBase | visitor | The CsvReaderVisitorBase instance to describe the file to. |
Remarks
The current version of this method uses memory-mapping behind the scenes in order to minimize the overhead of copying and cutting across discrete buffers, at the expense of slightly more overhead to set up the memory map than a typical read-from-stream pattern.
Exceptions
| Improve this Doc View SourceProcessStream(Stream, CsvReaderVisitorBase)
Describes the contents of a CSV stream to the given instance of the CsvReaderVisitorBase class.
Declaration
[Obsolete("Use CsvSyncInput.ForStream(csvStream).Process(visitor).")]
public static void ProcessStream(Stream csvStream, CsvReaderVisitorBase visitor)
Parameters
Type | Name | Description |
---|---|---|
Stream | csvStream | The CSV stream to describe. |
CsvReaderVisitorBase | visitor | The CsvReaderVisitorBase instance to describe the stream to. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when |
ProcessStream(Stream, CsvReaderVisitorBase, Int32)
Describes the contents of a CSV stream to the given instance of the CsvReaderVisitorBase class.
Declaration
[Obsolete("Use CsvSyncInput.ForStream(csvStream).WithMinReadBufferByteCount(bufferSize).Process(visitor).")]
public static void ProcessStream(Stream csvStream, CsvReaderVisitorBase visitor, int bufferSize)
Parameters
Type | Name | Description |
---|---|---|
Stream | csvStream | The CSV stream to describe. |
CsvReaderVisitorBase | visitor | The CsvReaderVisitorBase instance to describe the stream to. |
Int32 | bufferSize | The length of the buffer to use (default: 81920). |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when |
ArgumentOutOfRangeException | Thrown when |
ArgumentException | Thrown when |
ProcessStreamAsync(Stream, CsvReaderVisitorBase, Int32, IProgress<Int32>, CancellationToken)
Describes the contents of a CSV stream to the given instance of the CsvReaderVisitorBase class.
Declaration
[Obsolete("Use CsvAsyncInput.ForStream(csvStream).WithMinReadBufferByteCount(bufferSize).ProcessAsync(visitor, progress, cancellationToken).")]
public static ValueTask ProcessStreamAsync(Stream csvStream, CsvReaderVisitorBase visitor, int bufferSize, IProgress<int> progress = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
Stream | csvStream | The CSV stream to describe. |
CsvReaderVisitorBase | visitor | The CsvReaderVisitorBase instance to describe the stream to. |
Int32 | bufferSize | The length of the buffer to use (default: 81920). |
IProgress<Int32> | progress | An IProgress<T> that will be notified every time the next chunk of the stream is processed, with the size of the chunk (in bytes) that was processed.
All notifications will receive values less than or equal to the buffer size in bytes
(which, for this overload, is the value of There will be one last notification with value 0 after the entire stream has been processed and the final few stream elements have been consumed. This may be left as null if no progress notifications are needed. |
CancellationToken | cancellationToken | An instance of CancellationToken that may be used to signal that results are no longer needed, and so the method should terminate at its earliest convenience. This may be left as its default value of None if the operation does not need to support cancellation. |
Returns
Type | Description |
---|---|
ValueTask |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when |
ArgumentOutOfRangeException | Thrown when |
ArgumentException | Thrown when |
OperationCanceledException | Thrown (perhaps asynchronously) to acknowledge cancellation. A derived exception, such as TaskCanceledException, may also be thrown by the system. |
ObjectDisposedException | Thrown (perhaps asynchronously) if the underlying CancellationTokenSource
object backing |
ProcessStreamAsync(Stream, CsvReaderVisitorBase, IProgress<Int32>, CancellationToken)
Describes the contents of a CSV stream to the given instance of the CsvReaderVisitorBase class.
Declaration
[Obsolete("Use CsvAsyncInput.ForStream(csvStream).ProcessAsync(visitor, progress, cancellationToken).")]
public static ValueTask ProcessStreamAsync(Stream csvStream, CsvReaderVisitorBase visitor, IProgress<int> progress = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
Stream | csvStream | The CSV stream to describe. |
CsvReaderVisitorBase | visitor | The CsvReaderVisitorBase instance to describe the stream to. |
IProgress<Int32> | progress | An IProgress<T> that will be notified every time the next chunk of the stream is processed, with the size of the chunk (in bytes) that was processed. All notifications will receive values less than or equal to the buffer size in bytes (which, for this overload, is the default value of 81,920). There will be one last notification with value 0 after the entire stream has been processed and the final few stream elements have been consumed. This may be left as null if no progress notifications are needed. |
CancellationToken | cancellationToken | An instance of CancellationToken that may be used to signal that results are no longer needed, and so the method should terminate at its earliest convenience. This may be left as its default value of None if the operation does not need to support cancellation. |
Returns
Type | Description |
---|---|
ValueTask |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when |
ArgumentException | Thrown when |
OperationCanceledException | Thrown (perhaps asynchronously) to acknowledge cancellation. A derived exception, such as TaskCanceledException, may also be thrown by the system. |
ObjectDisposedException | Thrown (perhaps asynchronously) if the underlying CancellationTokenSource
object backing |