base class · System.IO
TextReader
public base class TextReader
Reads text: code points one at a time, lines, or all of it.
- Kind
- base class
- Namespace
- System.IO
- Assembly
- System.Core
- Access
- public, abstract
- Source file
TextIO.ant
Inheritance
- Base classes
-
AnyTextReader - Derived types
-
StreamReaderStringReader
Methods
The next code point without taking it, or -1 at the end.
The next code point, or -1 at the end.
virtual ReadLine() : str?
#
The next line without its line break ("\n" or "\r\n"), or null at the end.
virtual ReadToEnd() : str
#
Everything left.
virtual Close()
#
Inherited members (5)
GetTypemethod from AnyUndescribedmethod from AnyToStringmethod from AnyHashmethod from Anydestroymethod from Any
Source
TextReader as Antril, decompiled from its Larva HIR.
// System.IO.TextReader — System.Core (decompiled from Larva HIR)
import System;
into namespace System.IO
{
/// Reads text: code points one at a time, lines, or all of it.
public base class TextReader
{
public:
/// The next code point without taking it, or -1 at the end.
virtual Peek() : i32 => -1;
/// The next code point, or -1 at the end.
virtual Read() : i32 => -1;
/// The next line without its line break ("\n" or "\r\n"), or null at the end.
virtual ReadLine() : str?
{
i32 c = Read();
if (c < 0)
return null;
StringBuilder line = new StringBuilder();
loop (c >= 0 && c != 10)
{
if (c != 13 || Peek() != 10)
line.AppendCodePoint((u32)c);
c = Read();
}
return line.ToString();
}
/// Everything left.
virtual ReadToEnd() : str
{
StringBuilder all = new StringBuilder();
i32 c = Read();
loop (c >= 0)
{
all.AppendCodePoint((u32)c);
c = Read();
}
return all.ToString();
}
virtual Close()
{
}
}
}