Class StreamPrinter<TEntity>
- Namespace
- TypedRest.CommandLine.IO
- Assembly
- TypedRest.CommandLine.dll
Prints a stream of TEntity
s to an IConsole.
public class StreamPrinter<TEntity> : IObserver<TEntity>
Type Parameters
TEntity
- Inheritance
-
StreamPrinter<TEntity>
- Implements
-
IObserver<TEntity>
- Inherited Members
Constructors
StreamPrinter(IConsole)
Prints a stream of TEntity
s to an IConsole.
public StreamPrinter(IConsole console)
Parameters
console
IConsoleThe console to print to.
Methods
OnCompleted()
Notifies the observer that the provider has finished sending push-based notifications.
public void OnCompleted()
OnError(Exception)
Reprots an error
to the user via the console.
public virtual void OnError(Exception error)
Parameters
error
Exception
OnNext(TEntity)
Outputs a TEntity
to the user via the console.
public virtual void OnNext(TEntity value)
Parameters
value
TEntity
PrintAsync(IObservable<TEntity>, CancellationToken)
Prints all entities provided by the observable
to the JsonConsole.
public Task PrintAsync(IObservable<TEntity> observable, CancellationToken cancellationToken)
Parameters
observable
IObservable<TEntity>cancellationToken
CancellationToken
Returns
Remarks
This method is only intended to be called once per class instance.