JavaScript Editor JavaScript Editor     JavaScript Debugger

Previous Section Next Section

Main Page

Using the StreamReader Class

You can use the StreamReader class to read text data from files; here's the hierarchy of this class:

Object
   MarshalByRefObject
      TextReader
         StreamReader

You can find the more notable public properties of the StreamReader class in Table 13.14 and the more notable methods of this class in Table 13.15.

Table 13.14: Noteworthy public properties of StreamReader objects.

Property

Means

BaseStream

Holds the underlying stream, giving you access to that stream's properties and methods.

CurrentEncoding

Gets the character encoding for the stream reader.

Table 13.15: Noteworthy public methods of StreamReader objects.

Method

Means

Close

Closes the stream reader.

DiscardBufferedData

Discards the data in the buffer.

Peek

Looks ahead and returns the next available character (but does not actually read it as Read would, so does not advance the read/write position). Returns -1 if there is no more data waiting to be read.

Read

Reads the next character or characters.

ReadLine

Reads a line of text from the stream, returning that data as a string.

ReadToEnd

Reads from the current position to the end of the stream.

Previous Section Next Section




JavaScript Editor Free JavaScript Editor     JavaScript Editor