using System;
using System.Runtime.InteropServices;
namespace System.IO
{
/// Represents a reader that can read a sequential series of characters.
/// 2
// Token: 0x020001D3 RID: 467
[ComVisible(true)]
[Serializable]
public abstract class TextReader : IDisposable
{
/// Closes the and releases any system resources associated with the TextReader.
/// 1
// Token: 0x060017F2 RID: 6130 RVA: 0x0005C35C File Offset: 0x0005A55C
public virtual void Close()
{
this.Dispose(true);
}
/// Releases all resources used by the object.
// Token: 0x060017F3 RID: 6131 RVA: 0x0005C368 File Offset: 0x0005A568
public void Dispose()
{
this.Dispose(true);
}
/// Releases the unmanaged resources used by the and optionally releases the managed resources.
/// true to release both managed and unmanaged resources; false to release only unmanaged resources.
// Token: 0x060017F4 RID: 6132 RVA: 0x0005C374 File Offset: 0x0005A574
protected virtual void Dispose(bool disposing)
{
if (disposing)
{
GC.SuppressFinalize(this);
}
}
/// Reads the next character without changing the state of the reader or the character source. Returns the next available character without actually reading it from the input stream.
/// An integer representing the next character to be read, or -1 if no more characters are available or the stream does not support seeking.
/// The is closed.
/// An I/O error occurs.
/// 1
// Token: 0x060017F5 RID: 6133 RVA: 0x0005C384 File Offset: 0x0005A584
public virtual int Peek()
{
return -1;
}
/// Reads the next character from the input stream and advances the character position by one character.
/// The next character from the input stream, or -1 if no more characters are available. The default implementation returns -1.
/// The is closed.
/// An I/O error occurs.
/// 1
// Token: 0x060017F6 RID: 6134 RVA: 0x0005C388 File Offset: 0x0005A588
public virtual int Read()
{
return -1;
}
/// Reads a maximum of characters from the current stream and writes the data to , beginning at .
/// The number of characters that have been read. The number will be less than or equal to , depending on whether the data is available within the stream. This method returns zero if called when no more characters are left to read.
/// When this method returns, contains the specified character array with the values between and ( + - 1) replaced by the characters read from the current source.
/// The position in at which to begin writing.
/// The maximum number of characters to read. If the end of the stream is reached before of characters is read into , the current method returns.
///
/// is null.
/// The buffer length minus is less than .
///
/// or is negative.
/// The is closed.
/// An I/O error occurs.
/// 1
// Token: 0x060017F7 RID: 6135 RVA: 0x0005C38C File Offset: 0x0005A58C
public virtual int Read([In] [Out] char[] buffer, int index, int count)
{
int i;
for (i = 0; i < count; i++)
{
int num;
if ((num = this.Read()) == -1)
{
return i;
}
buffer[index + i] = (char)num;
}
return i;
}
/// Reads a maximum of characters from the current stream, and writes the data to , beginning at .
/// The position of the underlying stream is advanced by the number of characters that were read into .The number of characters that have been read. The number will be less than or equal to , depending on whether all input characters have been read.
/// When this method returns, this parameter contains the specified character array with the values between and ( + -1) replaced by the characters read from the current source.
/// The position in at which to begin writing.
/// The maximum number of characters to read.
///
/// is null.
/// The buffer length minus is less than .
///
/// or is negative.
/// The is closed.
/// An I/O error occurs.
/// 2
// Token: 0x060017F8 RID: 6136 RVA: 0x0005C3C4 File Offset: 0x0005A5C4
public virtual int ReadBlock([In] [Out] char[] buffer, int index, int count)
{
int num = 0;
int num2;
do
{
num2 = this.Read(buffer, index, count);
index += num2;
num += num2;
count -= num2;
}
while (num2 != 0 && count > 0);
return num;
}
/// Reads a line of characters from the current stream and returns the data as a string.
/// The next line from the input stream, or null if all characters have been read.
/// An I/O error occurs.
/// There is insufficient memory to allocate a buffer for the returned string.
/// The is closed.
/// The number of characters in the next line is larger than
/// 1
// Token: 0x060017F9 RID: 6137 RVA: 0x0005C3FC File Offset: 0x0005A5FC
public virtual string ReadLine()
{
return string.Empty;
}
/// Reads all characters from the current position to the end of the TextReader and returns them as one string.
/// A string containing all characters from the current position to the end of the TextReader.
/// An I/O error occurs.
/// The is closed.
/// There is insufficient memory to allocate a buffer for the returned string.
/// The number of characters in the next line is larger than
/// 1
// Token: 0x060017FA RID: 6138 RVA: 0x0005C404 File Offset: 0x0005A604
public virtual string ReadToEnd()
{
return string.Empty;
}
/// Creates a thread-safe wrapper around the specified TextReader.
/// A thread-safe .
/// The TextReader to synchronize.
///
/// is null.
/// 2
// Token: 0x060017FB RID: 6139 RVA: 0x0005C40C File Offset: 0x0005A60C
public static TextReader Synchronized(TextReader reader)
{
if (reader == null)
{
throw new ArgumentNullException("reader is null");
}
if (reader is SynchronizedReader)
{
return reader;
}
return new SynchronizedReader(reader);
}
/// Provides a TextReader with no data to read from.
/// 1
// Token: 0x04000723 RID: 1827
public static readonly TextReader Null = new TextReader.NullTextReader();
// Token: 0x020001D4 RID: 468
private class NullTextReader : TextReader
{
// Token: 0x060017FD RID: 6141 RVA: 0x0005C448 File Offset: 0x0005A648
public override string ReadLine()
{
return null;
}
}
}
}