WrappedTextWriter Class

Namespace
Kampute.DocToolkit.IO.Writers
Assembly
  • Kampute.DocToolkit.dll

Definition

Represents a text writer that wraps another TextWriter.
public abstract class WrappedTextWriter : TextWriter
Inheritance
Inherited by

Remarks

The WrappedTextWriter class provides a base implementation for text writers that need to delegate or transform content written to an underlying TextWriter. It implements the core functionality of the TextWriter class while forwarding write operations to the wrapped instance.

This pattern is useful for several scenarios in documentation generation:
  • Adding content transformations (like encoding, minification, or formatting)
  • Tracking or logging write operations
  • Adding buffering capabilities
  • Supporting special document-format specific behaviors
By using composition rather than inheritance from specific TextWriter implementations, the WrappedTextWriter can work with any TextWriter instance, making it adaptable to various output destinations (files, memory, console, etc.).

Thread Safety

Public static members of the type are guaranteed to be thread-safe. However, public instance members are not thread-safe.

Constructors

WrappedTextWriter(TextWriter, bool)Initializes a new instance of the WrappedTextWriter class.

Properties

EncodingGets the Encoding in use by the underlying TextWriter.
NewLineGets or sets the line terminator string used by the underlying TextWriter.
UnderlyingWriterGets the underlying TextWriter that this WrappedTextWriter writes to.

Methods

Dispose(bool)Releases the unmanaged resources used by the current writer and optionally releases the managed resources.
Flush()Clears all buffers for the underlying TextWriter and causes any buffered data to be written to the underlying device.
ToString()Returns a string that represents the current object.
Write(char)Writes a character to the underlying TextWriter.