Skip to content
ConsoleMonster
Class

StreamTerminalWriter

ConsoleMonster.Output

Namespace
ConsoleMonster.Output
Assembly
ConsoleMonster
Implements
ITerminalWriter IDisposable
Modifiers
sealed

Writes text to a stream, typically redirected standard output, in UTF-8 (without BOM) unless another encoding is given. Text is buffered until StreamTerminalWriter.Flush so a frame or block reaches the device in one write.

Inheritance

  • object
  • StreamTerminalWriter

Usage

Explore 1 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

Returned or exposed by 1

Constructors

StreamTerminalWriter 2 overloads
public StreamTerminalWriter(Stream stream, bool ownsStream = false) #

Creates a writer over a stream.

Parameters

stream System.IO.Stream required
The stream.
ownsStream bool = false optional
Whether disposing the writer disposes the stream.
public StreamTerminalWriter(Stream stream, Encoding encoding, bool ownsStream = false) #

Creates a writer over a stream that writes in encoding, without its preamble.

Parameters

stream System.IO.Stream required
The stream.
encoding System.Text.Encoding required
The encoding.
ownsStream bool = false optional
Whether disposing the writer disposes the stream.

Methods

public void Dispose() #

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Flush() #

Flushes buffered text to the device.

public static StreamTerminalWriter ForStandardOutput() #

Creates a writer over the process's real standard output (not Console.Out). On Windows it writes in the console code page, which is how a process that captures this one decodes it; CI logs and other platforms get UTF-8.

Returns

StreamTerminalWriter The writer.
public void Write(string text) #

Writes text. Implementations may buffer until ITerminalWriter.Flush.

Parameters

text string required
Text, possibly containing VT sequences.

Properties

public bool IsConsole { get; } #

Whether this writer targets a real console handle (as opposed to a file, pipe or buffer).