/// <summary>
        /// Initializes a new instance of the <see cref="PlainTextWriter"/> class using the specified <see cref="TextWriter"/>.
        /// </summary>
        /// <param name="writer">The <see cref="TextWriter"/> to which the <see cref="PlainTextWriter"/> should write.</param>
        /// <exception cref="ArgumentNullException"/>
        public PlainTextWriter(TextWriter writer) {
            if (writer == null)
                throw new ArgumentNullException(nameof(writer));

            Writer = writer;
            Settings = new PlainTextWriterSettings();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PlainTextWriter"/> class using the specified <see cref="TextWriter"/>.
        /// </summary>
        /// <param name="writer">The <see cref="TextWriter"/> to which the <see cref="PlainTextWriter"/> should write.</param>
        /// <exception cref="ArgumentNullException"/>
        public PlainTextWriter(TextWriter writer)
        {
            if (writer == null)
            {
                throw new ArgumentNullException(nameof(writer));
            }

            Writer   = writer;
            Settings = new PlainTextWriterSettings();
        }
        /// <summary>
        /// Creates a new <see cref="PlainTextWriter"/> instance using the specified <see cref="Stream"/> and <see cref="PlainTextWriterSettings"/>.
        /// </summary>
        /// <param name="output">The <see cref="Stream"/> to which the <see cref="PlainTextWriter"/> should write.</param>
        /// <param name="settings">The <see cref="PlainTextWriterSettings"/> containing the settings that the <see cref="PlainTextWriter"/> should use when writing.</param>
        /// <returns>An instance of the <see cref="PlainTextWriter"/> class.</returns>
        /// <exception cref="ArgumentNullException"/><exception cref="ArgumentException"/>
        public static PlainTextWriter Create(Stream output, PlainTextWriterSettings settings) {
            if (output == null)
                throw new ArgumentNullException(nameof(output));

            settings = settings ?? new PlainTextWriterSettings();
            StreamWriter stream = new StreamWriter(output, settings.Encoding);

            return new PlainTextWriter(stream) {
                Settings = settings
            };
        }
Exemplo n.º 4
0
        /// <summary>
        /// Creates a new <see cref="PlainTextWriter"/> instance using the specified <see cref="TextWriter"/> and <see cref="PlainTextWriterSettings"/>.
        /// </summary>
        /// <param name="writer">The <see cref="TextWriter"/> to which the <see cref="PlainTextWriter"/> should write.</param>
        /// <param name="settings">The <see cref="PlainTextWriterSettings"/> containing the settings that the <see cref="PlainTextWriter"/> should use when writing.</param>
        /// <returns>An instance of the <see cref="PlainTextWriter"/> class.</returns>
        /// <exception cref="ArgumentNullException"/>
        public static PlainTextWriter Create(TextWriter writer, PlainTextWriterSettings settings)
        {
            if (writer == null)
            {
                throw new ArgumentNullException(nameof(writer));
            }

            return(new PlainTextWriter(writer)
            {
                Settings = settings ?? new PlainTextWriterSettings()
            });
        }
Exemplo n.º 5
0
        /// <summary>
        /// Creates a new <see cref="PlainTextWriter"/> instance using the specified <see cref="Stream"/> and <see cref="PlainTextWriterSettings"/>.
        /// </summary>
        /// <param name="output">The <see cref="Stream"/> to which the <see cref="PlainTextWriter"/> should write.</param>
        /// <param name="settings">The <see cref="PlainTextWriterSettings"/> containing the settings that the <see cref="PlainTextWriter"/> should use when writing.</param>
        /// <returns>An instance of the <see cref="PlainTextWriter"/> class.</returns>
        /// <exception cref="ArgumentNullException"/><exception cref="ArgumentException"/>
        public static PlainTextWriter Create(Stream output, PlainTextWriterSettings settings)
        {
            if (output == null)
            {
                throw new ArgumentNullException(nameof(output));
            }

            settings = settings ?? new PlainTextWriterSettings();
            StreamWriter stream = new StreamWriter(output, settings.Encoding);

            return(new PlainTextWriter(stream)
            {
                Settings = settings
            });
        }
        /// <summary>
        /// Creates a new <see cref="PlainTextWriter"/> instance using the specified <see cref="TextWriter"/> and <see cref="PlainTextWriterSettings"/>.
        /// </summary>
        /// <param name="writer">The <see cref="TextWriter"/> to which the <see cref="PlainTextWriter"/> should write.</param>
        /// <param name="settings">The <see cref="PlainTextWriterSettings"/> containing the settings that the <see cref="PlainTextWriter"/> should use when writing.</param>
        /// <returns>An instance of the <see cref="PlainTextWriter"/> class.</returns>
        /// <exception cref="ArgumentNullException"/>
        public static PlainTextWriter Create(TextWriter writer, PlainTextWriterSettings settings) {
            if (writer == null)
                throw new ArgumentNullException(nameof(writer));

            return new PlainTextWriter(writer) {
                Settings = settings ?? new PlainTextWriterSettings()
            };
        }