/// <summary> /// Creates a new parser using the given <see cref="TextReader"/> and <see cref="CsvConfiguration"/>. /// </summary> /// <param name="reader">The <see cref="TextReader"/> with the CSV file data.</param> /// <param name="configuration">The configuration.</param> /// <param name="leaveOpen">true to leave the reader open after the CsvReader object is disposed, otherwise false.</param> public CsvParser(TextReader reader, ICsvParserConfiguration configuration, bool leaveOpen) { if (reader == null) { throw new ArgumentNullException(nameof(reader)); } if (configuration == null) { throw new ArgumentNullException(nameof(configuration)); } this.reader = new FieldReader(reader, configuration); this.configuration = configuration; this.leaveOpen = leaveOpen; }
/// <summary> /// Creates a new <see cref="FieldReader"/> using the given /// <see cref="TextReader"/> and <see cref="CsvConfiguration"/>. /// </summary> /// <param name="reader"></param> /// <param name="configuration"></param> public FieldReader(TextReader reader, ICsvParserConfiguration configuration) { this.reader = reader; buffer = new char[configuration.BufferSize]; this.configuration = configuration; }
/// <summary> /// Creates a new parser using the given <see cref="TextReader"/> and <see cref="CsvConfiguration"/>. /// </summary> /// <param name="reader">The <see cref="TextReader"/> with the CSV file data.</param> /// <param name="configuration">The configuration.</param> public CsvParser(TextReader reader, ICsvParserConfiguration configuration) : this(reader, configuration, false) { }
/// <summary> /// Creates a new parser using the given <see cref="TextReader"/> and <see cref="CsvConfiguration"/>. /// </summary> /// <param name="reader">The <see cref="TextReader"/> with the CSV file data.</param> /// <param name="configuration">The configuration.</param> public CsvParser( TextReader reader, ICsvParserConfiguration configuration ) : this(reader, configuration, false) { }
/// <summary> /// Creates a new parser using the given <see cref="TextReader"/> and <see cref="CsvConfiguration"/>. /// </summary> /// <param name="reader">The <see cref="TextReader"/> with the CSV file data.</param> /// <param name="configuration">The configuration.</param> /// <param name="leaveOpen">true to leave the reader open after the CsvReader object is disposed, otherwise false.</param> public CsvParser( TextReader reader, ICsvParserConfiguration configuration, bool leaveOpen ) { if( reader == null ) { throw new ArgumentNullException( nameof( reader ) ); } if( configuration == null ) { throw new ArgumentNullException( nameof( configuration ) ); } this.reader = new FieldReader( reader, configuration ); this.configuration = configuration; this.leaveOpen = leaveOpen; }
/// <summary> /// Creates a new <see cref="FieldReader"/> using the given /// <see cref="TextReader"/> and <see cref="CsvConfiguration"/>. /// </summary> /// <param name="reader"></param> /// <param name="configuration"></param> public FieldReader( TextReader reader, ICsvParserConfiguration configuration ) { this.reader = reader; buffer = new char[configuration.BufferSize]; this.configuration = configuration; }