Table of Contents

Class MessageTextWriter

Namespace
Dassie.Messages
Assembly
dc.dll

Implements a text writer which writes to multiple different text writers at once.

public class MessageTextWriter : TextWriter, IAsyncDisposable, IDisposable
Inheritance
MessageTextWriter
Implements
Inherited Members
Extension Methods

Remarks

Only overrides members internally used by MessageWriter.

Constructors

MessageTextWriter(TextWriter[])

public MessageTextWriter(TextWriter[] writers)

Parameters

writers TextWriter[]

Properties

Encoding

When overridden in a derived class, returns the character encoding in which the output is written.

public override Encoding Encoding { get; }

Property Value

Encoding

The character encoding in which the output is written.

Writers

public TextWriter[] Writers { get; }

Property Value

TextWriter[]

Methods

AddWriter(TextWriter)

public void AddWriter(TextWriter writer)

Parameters

writer TextWriter

AddWriters(TextWriter[])

public void AddWriters(TextWriter[] writers)

Parameters

writers TextWriter[]

Dispose()

public void Dispose()

Dispose(bool)

Releases the unmanaged resources used by the TextWriter and optionally releases the managed resources.

protected override void Dispose(bool disposing)

Parameters

disposing bool

true to release both managed and unmanaged resources; false to release only unmanaged resources.

Flush()

Clears all buffers for the current writer and causes any buffered data to be written to the underlying device.

public override void Flush()

FlushAsync()

Asynchronously clears all buffers for the current writer and causes any buffered data to be written to the underlying device.

public override Task FlushAsync()

Returns

Task

A task that represents the asynchronous flush operation.

Exceptions

ObjectDisposedException

The text writer is disposed.

InvalidOperationException

The writer is currently in use by a previous write operation.

FlushAsync(CancellationToken)

Asynchronously clears all buffers for the current writer and causes any buffered data to be written to the underlying device.

public override Task FlushAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

The CancellationToken to monitor for cancellation requests.

Returns

Task

A Task that represents the asynchronous flush operation.

Exceptions

ObjectDisposedException

The text writer is disposed.

InvalidOperationException

The writer is currently in use by a previous write operation.

OperationCanceledException

The cancellation token was canceled. This exception is stored into the returned task.

RemoveWriter(TextWriter)

public void RemoveWriter(TextWriter writer)

Parameters

writer TextWriter

Restore()

public void Restore()

SetWriters(TextWriter[])

public void SetWriters(TextWriter[] writers)

Parameters

writers TextWriter[]

Store()

public void Store()

Write(string)

Writes a string to the text stream.

public override void Write(string value)

Parameters

value string

The string to write.

Exceptions

ObjectDisposedException

The TextWriter is closed.

IOException

An I/O error occurs.

WriteLine()

Writes a line terminator to the text stream.

public override void WriteLine()

Exceptions

ObjectDisposedException

The TextWriter is closed.

IOException

An I/O error occurs.

WriteLine(string)

Writes a string to the text stream, followed by a line terminator.

public override void WriteLine(string value)

Parameters

value string

The string to write. If value is null, only the line terminator is written.

Exceptions

ObjectDisposedException

The TextWriter is closed.

IOException

An I/O error occurs.