/// <summary> /// Initializes a new instance of the class <see cref="PlainTextReader"/> class using the specified <see cref="TextReader"/>. /// </summary> /// <param name="reader">The TextReader which contains the data to be read.</param> /// <exception cref="ArgumentNullException"/> public PlainTextReader(TextReader reader) { if (reader == null) { throw new ArgumentNullException(nameof(reader)); } Reader = reader; Settings = new PlainTextReaderSettings(); }
/// <summary> /// Creates a new <see cref="PlainTextReader"/> instance using the specified <see cref="TextReader"/> and <see cref="PlainTextReaderSettings"/>. /// </summary> /// <param name="reader">The <see cref="TextReader"/> from which the <see cref="PlainTextReader"/> should read.</param> /// <param name="settings">The <see cref="PlainTextReaderSettings"/> containing the settings that the <see cref="PlainTextReader"/> should use when reading.</param> /// <returns>An instance of the <see cref="PlainTextReader"/> class.</returns> /// <exception cref="ArgumentNullException"/> public static PlainTextReader Create(TextReader reader, PlainTextReaderSettings settings) { if (reader == null) { throw new ArgumentNullException(nameof(reader)); } return(new PlainTextReader(reader) { Settings = settings ?? new PlainTextReaderSettings() }); }
/// <summary> /// Creates a new <see cref="PlainTextReader"/> instance using the specified <see cref="Stream"/> and <see cref="PlainTextReaderSettings"/>. /// </summary> /// <param name="stream">The <see cref="Stream"/> from which the <see cref="PlainTextReader"/> should read.</param> /// <param name="settings">The <see cref="PlainTextReaderSettings"/> containing the settings that the <see cref="PlainTextReader"/> should use when reading.</param> /// <returns>An instance of the <see cref="PlainTextReader"/> class.</returns> /// <exception cref="ArgumentNullException"/> public static PlainTextReader Create(Stream stream, PlainTextReaderSettings settings) { if (stream == null) throw new ArgumentNullException(nameof(stream)); settings = settings ?? new PlainTextReaderSettings(); StreamReader reader = new StreamReader(stream, settings.Encoding); return new PlainTextReader(reader) { Settings = settings }; }
/// <summary> /// Creates a new <see cref="PlainTextReader"/> instance using the specified <see cref="Stream"/> and <see cref="PlainTextReaderSettings"/>. /// </summary> /// <param name="stream">The <see cref="Stream"/> from which the <see cref="PlainTextReader"/> should read.</param> /// <param name="settings">The <see cref="PlainTextReaderSettings"/> containing the settings that the <see cref="PlainTextReader"/> should use when reading.</param> /// <returns>An instance of the <see cref="PlainTextReader"/> class.</returns> /// <exception cref="ArgumentNullException"/> public static PlainTextReader Create(Stream stream, PlainTextReaderSettings settings) { if (stream == null) { throw new ArgumentNullException(nameof(stream)); } settings = settings ?? new PlainTextReaderSettings(); StreamReader reader = new StreamReader(stream, settings.Encoding); return(new PlainTextReader(reader) { Settings = settings }); }
/// <summary> /// Creates a new <see cref="PlainTextReader"/> instance using the specified <see cref="TextReader"/> and <see cref="PlainTextReaderSettings"/>. /// </summary> /// <param name="reader">The <see cref="TextReader"/> from which the <see cref="PlainTextReader"/> should read.</param> /// <param name="settings">The <see cref="PlainTextReaderSettings"/> containing the settings that the <see cref="PlainTextReader"/> should use when reading.</param> /// <returns>An instance of the <see cref="PlainTextReader"/> class.</returns> /// <exception cref="ArgumentNullException"/> public static PlainTextReader Create(TextReader reader, PlainTextReaderSettings settings) { if (reader == null) throw new ArgumentNullException(nameof(reader)); return new PlainTextReader(reader) { Settings = settings ?? new PlainTextReaderSettings() }; }
/// <summary> /// Initializes a new instance of the class <see cref="PlainTextReader"/> class using the specified <see cref="TextReader"/>. /// </summary> /// <param name="reader">The TextReader which contains the data to be read.</param> /// <exception cref="ArgumentNullException"/> public PlainTextReader(TextReader reader) { if (reader == null) throw new ArgumentNullException(nameof(reader)); Reader = reader; Settings = new PlainTextReaderSettings(); }