/// <summary>
 /// Initializes a new instance of a FixedLengthParser.
 /// </summary>
 /// <param name="stream">A stream containing the records to parse.</param>
 /// <param name="schema">The schema object defining which columns are in each record.</param>
 /// <param name="options">An object containing settings for configuring the parser.</param>
 /// <exception cref="System.ArgumentNullException">The stream is null.</exception>
 /// <exception cref="System.ArgumentNullException">The schema is null.</exception>
 /// <exception cref="System.ArgumentNullException">The options object is null.</exception>
 public FixedLengthParser(Stream stream, FixedLengthSchema schema, FixedLengthParserOptions options)
 {
     if (stream == null)
     {
         throw new ArgumentNullException("stream");
     }
     if (schema == null)
     {
         throw new ArgumentNullException("schema");
     }
     if (options == null)
     {
         throw new ArgumentNullException("options");
     }
     this.stream = stream;
     StreamReader reader = new StreamReader(stream);
     text = reader.ReadToEnd();
     this.schema = schema;
     recordSeparator = options.RecordSeparator;
     filler = options.FillCharacter;
 }
Exemple #2
0
        /// <summary>
        /// Initializes a new instance of a FixedLengthParser.
        /// </summary>
        /// <param name="stream">A stream containing the records to parse.</param>
        /// <param name="schema">The schema object defining which columns are in each record.</param>
        /// <param name="options">An object containing settings for configuring the parser.</param>
        /// <exception cref="System.ArgumentNullException">The stream is null.</exception>
        /// <exception cref="System.ArgumentNullException">The schema is null.</exception>
        /// <exception cref="System.ArgumentNullException">The options object is null.</exception>
        public FixedLengthParser(Stream stream, FixedLengthSchema schema, FixedLengthParserOptions options)
        {
            if (stream == null)
            {
                throw new ArgumentNullException("stream");
            }
            if (schema == null)
            {
                throw new ArgumentNullException("schema");
            }
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }
            this.stream = stream;
            StreamReader reader = new StreamReader(stream);

            text            = reader.ReadToEnd();
            this.schema     = schema;
            recordSeparator = options.RecordSeparator;
            filler          = options.FillCharacter;
        }
 /// <summary>
 /// Initializes a new instance of a FixedLengthParser.
 /// </summary>
 /// <param name="fileName">The path to the file containing the records to parse.</param>
 /// <param name="schema">The schema object defining which columns are in each record.</param>
 /// <param name="options">An object containing settings for configuring the parser.</param>
 /// <exception cref="System.ArgumentNullException">The schema is null.</exception>
 /// <exception cref="System.ArgumentNullException">The options object is null.</exception>
 public FixedLengthParser(string fileName, FixedLengthSchema schema, FixedLengthParserOptions options)
     : this(File.OpenRead(fileName), schema, options)
 {
 }
Exemple #4
0
 /// <summary>
 /// Initializes a new instance of a FixedLengthParser.
 /// </summary>
 /// <param name="fileName">The path to the file containing the records to parse.</param>
 /// <param name="schema">The schema object defining which columns are in each record.</param>
 /// <param name="options">An object containing settings for configuring the parser.</param>
 /// <exception cref="System.ArgumentNullException">The schema is null.</exception>
 /// <exception cref="System.ArgumentNullException">The options object is null.</exception>
 public FixedLengthParser(string fileName, FixedLengthSchema schema, FixedLengthParserOptions options)
     : this(File.OpenRead(fileName), schema, options)
 {
 }