User Tools

Site Tools

blog:2023-09-26_c_streamwriter_class



2023-09-26 C#: StreamWriter Class

  •         public StreamWriter(Stream stream);
            public StreamWriter(string path);
            public StreamWriter(Stream stream, Encoding encoding);
            public StreamWriter(string path, bool append);
            public StreamWriter(Stream stream, Encoding encoding, int bufferSize);
            public StreamWriter(string path, bool append, Encoding encoding);
            public StreamWriter(Stream stream, Encoding encoding, int bufferSize, bool leaveOpen);
            public StreamWriter(string path, bool append, Encoding encoding, int bufferSize);

Detail

  •         //
            // Summary:
            //     Initializes a new instance of the System.IO.StreamWriter class for the specified
            //     stream by using UTF-8 encoding and the default buffer size.
            //
            // Parameters:
            //   stream:
            //     The stream to write to.
            //
            // Exceptions:
            //   T:System.ArgumentException:
            //     stream is not writable.
            //
            //   T:System.ArgumentNullException:
            //     stream is null.
            public StreamWriter(Stream stream);
            //
            // Summary:
            //     Initializes a new instance of the System.IO.StreamWriter class for the specified
            //     file by using the default encoding and buffer size.
            //
            // Parameters:
            //   path:
            //     The complete file path to write to. path can be a file name.
            //
            // Exceptions:
            //   T:System.UnauthorizedAccessException:
            //     Access is denied.
            //
            //   T:System.ArgumentException:
            //     path is an empty string (""). -or- path contains the name of a system device
            //     (com1, com2, and so on).
            //
            //   T:System.ArgumentNullException:
            //     path is null.
            //
            //   T:System.IO.DirectoryNotFoundException:
            //     The specified path is invalid (for example, it is on an unmapped drive).
            //
            //   T:System.IO.PathTooLongException:
            //     The specified path, file name, or both exceed the system-defined maximum length.
            //     For example, on Windows-based platforms, paths must not exceed 248 characters,
            //     and file names must not exceed 260 characters.
            //
            //   T:System.IO.IOException:
            //     path includes an incorrect or invalid syntax for file name, directory name, or
            //     volume label syntax.
            //
            //   T:System.Security.SecurityException:
            //     The caller does not have the required permission.
            public StreamWriter(string path);
            //
            // Summary:
            //     Initializes a new instance of the System.IO.StreamWriter class for the specified
            //     stream by using the specified encoding and the default buffer size.
            //
            // Parameters:
            //   stream:
            //     The stream to write to.
            //
            //   encoding:
            //     The character encoding to use.
            //
            // Exceptions:
            //   T:System.ArgumentNullException:
            //     stream or encoding is null.
            //
            //   T:System.ArgumentException:
            //     stream is not writable.
            public StreamWriter(Stream stream, Encoding encoding);
            //
            // Summary:
            //     Initializes a new instance of the System.IO.StreamWriter class for the specified
            //     file by using the default encoding and buffer size. If the file exists, it can
            //     be either overwritten or appended to. If the file does not exist, this constructor
            //     creates a new file.
            //
            // Parameters:
            //   path:
            //     The complete file path to write to.
            //
            //   append:
            //     true to append data to the file; false to overwrite the file. If the specified
            //     file does not exist, this parameter has no effect, and the constructor creates
            //     a new file.
            //
            // Exceptions:
            //   T:System.UnauthorizedAccessException:
            //     Access is denied.
            //
            //   T:System.ArgumentException:
            //     path is empty. -or- path contains the name of a system device (com1, com2, and
            //     so on).
            //
            //   T:System.ArgumentNullException:
            //     path is null.
            //
            //   T:System.IO.DirectoryNotFoundException:
            //     The specified path is invalid (for example, it is on an unmapped drive).
            //
            //   T:System.IO.IOException:
            //     path includes an incorrect or invalid syntax for file name, directory name, or
            //     volume label syntax.
            //
            //   T:System.IO.PathTooLongException:
            //     The specified path, file name, or both exceed the system-defined maximum length.
            //     For example, on Windows-based platforms, paths must not exceed 248 characters,
            //     and file names must not exceed 260 characters.
            //
            //   T:System.Security.SecurityException:
            //     The caller does not have the required permission.
            public StreamWriter(string path, bool append);
            //
            // Summary:
            //     Initializes a new instance of the System.IO.StreamWriter class for the specified
            //     stream by using the specified encoding and buffer size.
            //
            // Parameters:
            //   stream:
            //     The stream to write to.
            //
            //   encoding:
            //     The character encoding to use.
            //
            //   bufferSize:
            //     The buffer size, in bytes.
            //
            // Exceptions:
            //   T:System.ArgumentNullException:
            //     stream or encoding is null.
            //
            //   T:System.ArgumentOutOfRangeException:
            //     bufferSize is negative.
            //
            //   T:System.ArgumentException:
            //     stream is not writable.
            public StreamWriter(Stream stream, Encoding encoding, int bufferSize);
            //
            // Summary:
            //     Initializes a new instance of the System.IO.StreamWriter class for the specified
            //     file by using the specified encoding and default buffer size. If the file exists,
            //     it can be either overwritten or appended to. If the file does not exist, this
            //     constructor creates a new file.
            //
            // Parameters:
            //   path:
            //     The complete file path to write to.
            //
            //   append:
            //     true to append data to the file; false to overwrite the file. If the specified
            //     file does not exist, this parameter has no effect, and the constructor creates
            //     a new file.
            //
            //   encoding:
            //     The character encoding to use.
            //
            // Exceptions:
            //   T:System.UnauthorizedAccessException:
            //     Access is denied.
            //
            //   T:System.ArgumentException:
            //     path is empty. -or- path contains the name of a system device (com1, com2, and
            //     so on).
            //
            //   T:System.ArgumentNullException:
            //     path is null.
            //
            //   T:System.IO.DirectoryNotFoundException:
            //     The specified path is invalid (for example, it is on an unmapped drive).
            //
            //   T:System.IO.IOException:
            //     path includes an incorrect or invalid syntax for file name, directory name, or
            //     volume label syntax.
            //
            //   T:System.IO.PathTooLongException:
            //     The specified path, file name, or both exceed the system-defined maximum length.
            //     For example, on Windows-based platforms, paths must not exceed 248 characters,
            //     and file names must not exceed 260 characters.
            //
            //   T:System.Security.SecurityException:
            //     The caller does not have the required permission.
            public StreamWriter(string path, bool append, Encoding encoding);
            //
            // Summary:
            //     Initializes a new instance of the System.IO.StreamWriter class for the specified
            //     stream by using the specified encoding and buffer size, and optionally leaves
            //     the stream open.
            //
            // Parameters:
            //   stream:
            //     The stream to write to.
            //
            //   encoding:
            //     The character encoding to use.
            //
            //   bufferSize:
            //     The buffer size, in bytes.
            //
            //   leaveOpen:
            //     true to leave the stream open after the System.IO.StreamWriter object is disposed;
            //     otherwise, false.
            //
            // Exceptions:
            //   T:System.ArgumentNullException:
            //     stream or encoding is null.
            //
            //   T:System.ArgumentOutOfRangeException:
            //     bufferSize is negative.
            //
            //   T:System.ArgumentException:
            //     stream is not writable.
            public StreamWriter(Stream stream, Encoding encoding, int bufferSize, bool leaveOpen);
            //
            // Summary:
            //     Initializes a new instance of the System.IO.StreamWriter class for the specified
            //     file on the specified path, using the specified encoding and buffer size. If
            //     the file exists, it can be either overwritten or appended to. If the file does
            //     not exist, this constructor creates a new file.
            //
            // Parameters:
            //   path:
            //     The complete file path to write to.
            //
            //   append:
            //     true to append data to the file; false to overwrite the file. If the specified
            //     file does not exist, this parameter has no effect, and the constructor creates
            //     a new file.
            //
            //   encoding:
            //     The character encoding to use.
            //
            //   bufferSize:
            //     The buffer size, in bytes.
            //
            // Exceptions:
            //   T:System.ArgumentException:
            //     path is an empty string (""). -or- path contains the name of a system device
            //     (com1, com2, and so on).
            //
            //   T:System.ArgumentNullException:
            //     path or encoding is null.
            //
            //   T:System.ArgumentOutOfRangeException:
            //     bufferSize is negative.
            //
            //   T:System.IO.IOException:
            //     path includes an incorrect or invalid syntax for file name, directory name, or
            //     volume label syntax.
            //
            //   T:System.Security.SecurityException:
            //     The caller does not have the required permission.
            //
            //   T:System.UnauthorizedAccessException:
            //     Access is denied.
            //
            //   T:System.IO.DirectoryNotFoundException:
            //     The specified path is invalid (for example, it is on an unmapped drive).
            //
            //   T:System.IO.PathTooLongException:
            //     The specified path, file name, or both exceed the system-defined maximum length.
            //     For example, on Windows-based platforms, paths must not exceed 248 characters,
            //     and file names must not exceed 260 characters.
            [SecuritySafeCritical]
            public StreamWriter(string path, bool append, Encoding encoding, int bufferSize);

TAGS

  • 52 person(s) visited this page until now.

Permalink blog/2023-09-26_c_streamwriter_class.txt · Last modified: 2023/09/26 11:17 by jethro

oeffentlich