Class FileEventStream
Class for using a file of events as an event stream. The format of the file is one event per line with each line consisting of outcome followed by contexts (space delimited).
public class FileEventStream : ObjectStreamBase<Event?>, IObjectStream<Event?>, IDisposable
- Inheritance
-
FileEventStream
- Implements
- Derived
- Inherited Members
Constructors
FileEventStream(FileInfo)
Creates a new file event stream from the specified file.
public FileEventStream(FileInfo file)
Parameters
fileFileInfothe file containing the events.
Exceptions
- IOException
When the specified file can not be read.
FileEventStream(TextReader)
public FileEventStream(TextReader reader)
Parameters
readerTextReader
FileEventStream(string, Encoding?)
Creates a new file event stream from the specified file name.
public FileEventStream(string fileName, Encoding? encoding = null)
Parameters
fileNamestringthe name of the file containing the events.
encodingEncodingthe encoding of the file, or
nullfor the default.
Exceptions
- IOException
When the specified file can not be read.
Fields
reader
protected readonly TextReader reader
Field Value
Methods
Dispose(bool)
Releases the resources from this object stream.
protected override void Dispose(bool disposing)
Parameters
disposingbool
Read()
Returns the next object. Calling this method repeatedly until it returns
null will return each object from the underlying source exactly once.
public override Event? Read()
Returns
- Event
the next object or
nullto signal that the stream is exhausted
Exceptions
- IOException
if there is an error during reading
Reset()
Repositions the stream at the beginning and the previously seen object sequence will be repeated exactly. This method can be used to re-read the stream if multiple passes over the objects are required.
The implementation of this method is optional.
public override void Reset()
Exceptions
- IOException
if there is an error during resetting the stream
- NotSupportedException
if reset is not supported on this stream
ToLine(Event)
Generates a string representing the specified event.
public static string ToLine(Event @event)
Parameters
eventEventThe event for which a string representation is needed.
Returns
- string
A string representing the specified event.