Exemple #1
0
 /// <summary>
 /// Initializes a new FixedLengthReader with the given schema.
 /// </summary>
 /// <param name="reader">A reader over the fixed-length document.</param>
 /// <param name="schema">The schema of the fixed-length document.</param>
 /// <param name="options">The options controlling how the fixed-length document is read.</param>
 /// <exception cref="ArgumentNullException">The reader is null.</exception>
 /// <exception cref="ArgumentNullException">The schema is null.</exception>
 public FixedLengthReader(TextReader reader, FixedLengthSchema schema, FixedLengthOptions options = null)
 {
     if (reader == null)
     {
         throw new ArgumentNullException("reader");
     }
     if (schema == null)
     {
         throw new ArgumentNullException("schema");
     }
     if (options == null)
     {
         options = new FixedLengthOptions();
     }
     parser       = new FixedLengthRecordParser(reader, schema, options);
     this.schema  = schema;
     this.options = options.Clone();
 }
 private FixedLengthReader(TextReader reader, FixedLengthSchema schema, FixedLengthOptions options = null, bool hasSchema = true)
 {
     if (reader == null)
     {
         throw new ArgumentNullException(nameof(reader));
     }
     if (hasSchema && schema == null)
     {
         throw new ArgumentNullException(nameof(schema));
     }
     if (options == null)
     {
         options = new FixedLengthOptions();
     }
     parser        = new FixedLengthRecordParser(reader, schema, options);
     this.metadata = new Metadata()
     {
         Schema  = schema,
         Options = options.Clone()
     };
 }