This constructor initializes the encoding to UTF8Encoding, the BaseStream property using the stream parameter, and the internal buffer to the default size.
The path parameter can be a file name, including a file on a Universal Naming Convention (UNC) share.
The path parameter is not required to be a file stored on disk; it can be any part of a system that supports access using streams.
The detectEncodingFromByteOrderMarks parameter detects the encoding by looking at the first three bytes of the stream. It automatically recognizes UTF-8, little-endian Unicode, and big-endian Unicode text if the file starts with the appropriate byte order marks. Otherwise, the user-provided encoding is used. See the Encoding..::.GetPreamble method for more information.
For a list of common I/O tasks, see Common I/O Tasks.