Exemple #1
0
 /// <summary>
 /// Constructor that will deal with files and convert them into a stream.
 /// </summary>
 /// <param name="path">The file path that we need to create a stream from.</param>
 /// <param name="options">The stream options we need to use for parsing.</param>
 public CsvStreamWriter(string path, CsvStreamOptions options)
 {
     _options   = options;
     _stream    = File.Open(path, FileMode.Truncate, FileAccess.Write);
     _converter = new CsvConverter <TModel>(_options, new List <string>());
     _writer    = new StreamWriter(_stream, Encoding.UTF8);
     _buffer    = new StringBuilder(256 * 1024);
 }
Exemple #2
0
 /// <summary>
 /// Constructor that will deal with streams.
 /// </summary>
 /// <param name="stream">The stream the csv data exists in.</param>
 /// <param name="options">The stream options we need to use for parsing.</param>
 public CsvStreamWriter(Stream stream, CsvStreamOptions options)
 {
     _options   = options;
     _stream    = stream;
     _converter = new CsvConverter <TModel>(_options, new List <string>());
     _writer    = new StreamWriter(_stream, Encoding.UTF8);
     _buffer    = new StringBuilder(256 * 1024);
 }