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
Any TextReader
Tipos derivados
StreamReader StringReader

Métodos

virtual Peek() : i32
#

virtual

The next code point without taking it, or -1 at the end.

virtual Read() : i32
#

virtual

The next code point, or -1 at the end.

virtual ReadLine() : str?
#

virtual

The next line without its line break ("\n" or "\r\n"), or null at the end.

virtual ReadToEnd() : str
#

virtual

Everything left.

virtual Close()
#

virtual

Miembros heredados (5)

Código fuente

TextReader en Antril, descompilado a partir de su Larva HIR.

System.IO.TextReader.ant
// 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()
			{
			}
	}
}
Esc