StreamReader | CF 1.0, ECMA 1.0, serializable, marshal by reference, disposable |
System.IO (mscorlib.dll) | class |
This class is an extension of
a TextReader and
provides implementations for all its methods.
CurrentEncoding returns the current encoding the
StreamReader is using. If you would like to
discard the buffered data (so it isn't written to a
disk or other resource), call DiscardBufferedData(
).
This class is a quick way to open a file for reading. Simply call the
constructor with a string containing the filename, and you can
immediately begin reading from the file with methods such as
Read( ), ReadLine( ), or
ReadToEnd( ).
public class StreamReader : TextReader {
// Public Constructors
public StreamReader(Stream stream);
public StreamReader(Stream stream, bool detectEncodingFromByteOrderMarks);
public StreamReader(Stream stream, System.Text.Encoding encoding);
public StreamReader(Stream stream, System.Text.Encoding encoding,
bool detectEncodingFromByteOrderMarks);
public StreamReader(Stream stream, System.Text.Encoding encoding,
bool detectEncodingFromByteOrderMarks, int bufferSize);
public StreamReader(string path);
public StreamReader(string path, bool detectEncodingFromByteOrderMarks);
public StreamReader(string path, System.Text.Encoding encoding);
public StreamReader(string path, System.Text.Encoding encoding,
bool detectEncodingFromByteOrderMarks);
public StreamReader(string path, System.Text.Encoding encoding,
bool detectEncodingFromByteOrderMarks, int bufferSize);
// Public Static Fields
public static readonly StreamReader Null;
// =System.IO.StreamReader+NullStreamReader
// Public Instance Properties
public virtual Stream BaseStream{get; }
public virtual Encoding CurrentEncoding{get; }
// Public Instance Methods
public override void Close( );
// overrides TextReader
public void DiscardBufferedData( );
public override int Peek( );
// overrides TextReader
public override int Read( );
// overrides TextReader
public override int Read(in char[ ] buffer, int index, int count)
// overrides TextReader
public override string ReadLine( );
// overrides TextReader
public override string ReadToEnd( );
// overrides TextReader
// Protected Instance Methods
protected override void Dispose(bool disposing);
// overrides TextReader
}
Hierarchy
System.Object
System.MarshalByRefObject
TextReader(System.IDisposable)
StreamReader
Returned By
System.Diagnostics.Process.{StandardError,
StandardOutput}, File.OpenText(
), FileInfo.OpenText( )
|