A text reader that reads text by lines, with '\n' invariably treated as the line separator, regardless of the OS.
On Microsoft Windows the line separator is "\r\n". Since it contains '\n', this reader will still be able to recognize a line break. It will also strip of the penultimate character (\r) when returning the line in text. If the use case requires that the reader, when running on Windows, disregard '\n' that doesn't trail '\r', this class cannot be used.
This class is not thread-safe and must be protected by lock when used in a multi-threaded context.
Parent Class
Type | Name | Signature |
---|---|---|
constructor | TextReader | public TextReader(System.IO.Stream) |
constructor | TextReader | public TextReader(System.IO.Stream, string, int, bool) |
method | readln | public String readln() |
public TextReader(Stream stream)
Create a TextReader to read text from the specified stream. Use default buffer size (8K) and default chatset (ASCII); also close the stream after end-of-file is confirmed by the caller.
Parameters
Throws
public TextReader(Stream stream, string charset, int bufferSize, bool autoClose)
Create a TextReader to read text from the specified stream.
Parameters
Throws
public String readln()
Read the next line off of the stream.
Returns