base class · System.IO
TextReader
public base class TextReader
Reads text: code points one at a time, lines, or all of it.
- Tipo
- base class
- Espacio de nombres
- System.IO
- Ensamblado
- System.Core
- Acceso
- public, abstract
- Archivo fuente
TextIO.ant
Herencia
- Clases base
-
AnyTextReader - Tipos derivados
-
StreamReaderStringReader
Métodos
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()
#
Miembros heredados (5)
GetTypemétodo de AnyUndescribedmétodo de AnyToStringmétodo de AnyHashmétodo de Anydestroymétodo de Any
Código fuente
TextReader en Antril, descompilado a partir de su 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()
{
}
}
}