WrappedTextWriter Class
- Namespace
- Kampute.DocToolkit.IO.Writers
- Assembly
Definition
Represents a text writer that wraps another
TextWriter.
public abstract class WrappedTextWriter : TextWriter
- Inheritance
- Inherited by
Thread Safety
Constructors
Properties
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. |
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.).