C# Class NanoByte.Common.Streams.StreamConsumer

Continously reads lines from a StreamReader using a background thread while providing them to a foreground thread on demand.
Useful for processing Process.StandardOutput and Process.StandardError without risking deadlocks.
Datei anzeigen Open project: nano-byte/common Class Usage Examples

Public Methods

Method Description
StreamConsumer ( [ reader ) : System

Starts reading from the stream in a background thread.

ToString ( ) : string

Returns all buffered lines that have not been read yet.

WaitForEnd ( ) : void

Waits for StreamReader.EndOfStream.

Private Methods

Method Description
ReadLine ( ) : string
ThreadStart ( ) : void

Method Details

StreamConsumer() public method

Starts reading from the stream in a background thread.
public StreamConsumer ( [ reader ) : System
reader [ The stream to read from.
return System

ToString() public method

Returns all buffered lines that have not been read yet.
public ToString ( ) : string
return string

WaitForEnd() public method

Waits for StreamReader.EndOfStream.
public WaitForEnd ( ) : void
return void