Class TextDataReader
Text reader for Stream.
public class TextDataReader
- Inheritance
-
TextDataReader
- Inherited Members
Constructors
TextDataReader(Stream)
Initializes a new instance of the TextDataReader class.
public TextDataReader(Stream stream)
Parameters
stream
StreamStream to read from.
Remarks
The default encoding is UTF-8.
TextDataReader(Stream, string)
Initializes a new instance of the TextDataReader class.
public TextDataReader(Stream stream, string encoding)
Parameters
TextDataReader(Stream, Encoding)
Initializes a new instance of the TextDataReader class.
public TextDataReader(Stream stream, Encoding encoding)
Parameters
Properties
AutoNewLine
Gets or sets a value indicating whether reads any kind of NewLine format (\r\n or \n). If true, this ignore the NewLine field.
public bool AutoNewLine { get; set; }
Property Value
- bool
If true, it will treat new lines any matching of \r\n or \n. Otherwise false.
Encoding
Gets the encoding.
public Encoding Encoding { get; }
Property Value
NewLine
Gets or sets the new line and set to false AutoNewLine.
public string NewLine { get; set; }
Property Value
- string
The new line.
Remarks
The default value is OS-dependant.
Stream
Gets the stream.
public DataStream Stream { get; }
Property Value
Methods
Peek()
Read the next char without changing the position.
public char Peek()
Returns
- char
The next char.
Peek(int)
Read the next count of chars without changing the position.
public char[] Peek(int count)
Parameters
count
intNumber of chars to read.
Returns
- char[]
The next chars.
PeekLine()
Read the next line without changing the position.
public string PeekLine()
Returns
- string
The next line.
PeekToToken(string)
Read until a string / token is found without changing the position.
public string PeekToToken(string token)
Parameters
token
stringToken to find.
Returns
- string
The next chars.
Read()
Read a char from the stream.
public char Read()
Returns
- char
The read char.
Read(int)
Read the specified number of chars.
public char[] Read(int count)
Parameters
count
intChars to read.
Returns
- char[]
The read chars.
ReadLine()
Reads a line.
public string ReadLine()
Returns
- string
The line.
ReadToEnd()
Reads to the end.
public string ReadToEnd()
Returns
- string
The string.
ReadToToken(string)
Reads a string until a string / token is found.
public string ReadToToken(string token)
Parameters
token
stringToken to find.
Returns
- string
The read string or null.
Exceptions
- EndOfStreamException
If the stream position is at the end.