C# Class LumenWorks.Framework.IO.Csv.CachedCsvReader

Represents a reader that provides fast, cached, dynamic access to CSV data.
The number of records is limited to System.Int32.MaxValue - 1.
Inheritance: CsvReader, IListSource
Mostra file Open project: phatcher/CsvReader Class Usage Examples

Private Properties

Property Type Description
IListSource System.Collections.IList

Public Methods

Method Description
CachedCsvReader ( TextReader reader, bool hasHeaders ) : System

Initializes a new instance of the CsvReader class.

CachedCsvReader ( TextReader reader, bool hasHeaders, char delimiter ) : System

Initializes a new instance of the CsvReader class.

CachedCsvReader ( TextReader reader, bool hasHeaders, char delimiter, char quote, char escape, char comment, ValueTrimmingOptions trimmingOptions, int bufferSize, string nullValue = null ) : System

Initializes a new instance of the CsvReader class.

CachedCsvReader ( TextReader reader, bool hasHeaders, char delimiter, char quote, char escape, char comment, ValueTrimmingOptions trimmingOptions, string nullValue = null ) : System

Initializes a new instance of the CsvReader class.

CachedCsvReader ( TextReader reader, bool hasHeaders, char delimiter, int bufferSize ) : System

Initializes a new instance of the CsvReader class.

CachedCsvReader ( TextReader reader, bool hasHeaders, int bufferSize ) : System

Initializes a new instance of the CsvReader class.

MoveTo ( long record ) : bool

Moves to the specified record index.

MoveToLastCachedRecord ( ) : void

Moves to the last record read so far.

MoveToStart ( ) : void

Moves before the first record.

ReadToEnd ( ) : void

Reads the CSV stream from the current position to the end of the stream.

this ( int field ) : string

Gets the field at the specified index.

Protected Methods

Method Description
ReadNextRecord ( bool onlyReadHeaders, bool skipToNextLine ) : bool

Reads the next record.

Private Methods

Method Description
IListSource ( ) : System.Collections.IList

Method Details

CachedCsvReader() public method

Initializes a new instance of the CsvReader class.
/// is a . /// /// Cannot read from . ///
public CachedCsvReader ( TextReader reader, bool hasHeaders ) : System
reader System.IO.TextReader A pointing to the CSV file.
hasHeaders bool if field names are located on the first non commented line, otherwise, .
return System

CachedCsvReader() public method

Initializes a new instance of the CsvReader class.
/// is a . /// /// Cannot read from . ///
public CachedCsvReader ( TextReader reader, bool hasHeaders, char delimiter ) : System
reader System.IO.TextReader A pointing to the CSV file.
hasHeaders bool if field names are located on the first non commented line, otherwise, .
delimiter char The delimiter character separating each field (default is ',').
return System

CachedCsvReader() public method

Initializes a new instance of the CsvReader class.
/// is a . /// /// must be 1 or more. ///
public CachedCsvReader ( TextReader reader, bool hasHeaders, char delimiter, char quote, char escape, char comment, ValueTrimmingOptions trimmingOptions, int bufferSize, string nullValue = null ) : System
reader System.IO.TextReader A pointing to the CSV file.
hasHeaders bool if field names are located on the first non commented line, otherwise, .
delimiter char The delimiter character separating each field (default is ',').
quote char The quotation character wrapping every field (default is ''').
escape char /// The escape character letting insert quotation characters inside a quoted field (default is '\'). /// If no escape character, set to '\0' to gain some performance. ///
comment char The comment character indicating that a line is commented out (default is '#').
trimmingOptions ValueTrimmingOptions Determines how values should be trimmed.
bufferSize int The buffer size in bytes.
nullValue string The value which denotes a DbNull-value.
return System

CachedCsvReader() public method

Initializes a new instance of the CsvReader class.
/// is a . /// /// Cannot read from . ///
public CachedCsvReader ( TextReader reader, bool hasHeaders, char delimiter, char quote, char escape, char comment, ValueTrimmingOptions trimmingOptions, string nullValue = null ) : System
reader System.IO.TextReader A pointing to the CSV file.
hasHeaders bool if field names are located on the first non commented line, otherwise, .
delimiter char The delimiter character separating each field (default is ',').
quote char The quotation character wrapping every field (default is ''').
escape char /// The escape character letting insert quotation characters inside a quoted field (default is '\'). /// If no escape character, set to '\0' to gain some performance. ///
comment char The comment character indicating that a line is commented out (default is '#').
trimmingOptions ValueTrimmingOptions Determines how values should be trimmed.
nullValue string The value which denotes a DbNull-value.
return System

CachedCsvReader() public method

Initializes a new instance of the CsvReader class.
/// is a . /// /// Cannot read from . ///
public CachedCsvReader ( TextReader reader, bool hasHeaders, char delimiter, int bufferSize ) : System
reader System.IO.TextReader A pointing to the CSV file.
hasHeaders bool if field names are located on the first non commented line, otherwise, .
delimiter char The delimiter character separating each field (default is ',').
bufferSize int The buffer size in bytes.
return System

CachedCsvReader() public method

Initializes a new instance of the CsvReader class.
/// is a . /// /// Cannot read from . ///
public CachedCsvReader ( TextReader reader, bool hasHeaders, int bufferSize ) : System
reader System.IO.TextReader A pointing to the CSV file.
hasHeaders bool if field names are located on the first non commented line, otherwise, .
bufferSize int The buffer size in bytes.
return System

MoveTo() public method

Moves to the specified record index.
/// The instance has been disposed of. ///
public MoveTo ( long record ) : bool
record long The record index.
return bool

MoveToLastCachedRecord() public method

Moves to the last record read so far.
public MoveToLastCachedRecord ( ) : void
return void

MoveToStart() public method

Moves before the first record.
public MoveToStart ( ) : void
return void

ReadNextRecord() protected method

Reads the next record.
/// The instance has been disposed of. ///
protected ReadNextRecord ( bool onlyReadHeaders, bool skipToNextLine ) : bool
onlyReadHeaders bool /// Indicates if the reader will proceed to the next record after having read headers. /// if it stops after having read headers; otherwise, . ///
skipToNextLine bool /// Indicates if the reader will skip directly to the next line without parsing the current one. /// To be used when an error occurs. ///
return bool

ReadToEnd() public method

Reads the CSV stream from the current position to the end of the stream.
/// The instance has been disposed of. ///
public ReadToEnd ( ) : void
return void

this() public method

Gets the field at the specified index.
/// must be included in [0, [. /// /// No record read yet. Call ReadLine() first. /// /// The CSV data appears to be missing a field. /// /// The CSV appears to be corrupt at the current position. /// /// The instance has been disposed of. ///
public this ( int field ) : string
field int
return string