/// <summary> /// Returns the next Event object held in this EventStream. Each call to nextEvent advances the EventStream. /// </summary> /// <returns> /// The Event object which is next in this EventStream if there are any events in the stream; /// otherwise <c>null</c>. /// </returns> public override Event Next() { LoopForNextEvent(); Event currentEvent = _nextEvent; if (_dataStream.HasNext()) { _nextEvent = CreateEvent((string)_dataStream.NextToken()); } else { _nextEvent = null; } return(currentEvent); }
/// <summary> /// Initializes a new instance of the <see cref="BasicEventStream"/> class. /// </summary> /// <param name="dataStream">The data stream.</param> /// <param name="separator">The separator.</param> public BasicEventStream(IDataStream dataStream, string separator) { _dataStream = dataStream; _separator = separator; _contextGenerator = new BasicContextGenerator(_separator); if (_dataStream.HasNext()) { _nextEvent = CreateEvent((string)_dataStream.NextToken()); } }