A text writer that writes text to a stream.
This class is not thread-safe and must be protected by lock when used in a multi-threaded context.
Parent Class
Type | Name | Signature |
---|---|---|
constructor | TextWriter | public TextWriter(System.IO.Stream) |
constructor | TextWriter | public TextWriter(System.IO.Stream, string, int, bool) |
method | close | public void close() |
method | flush | public void flush() |
method | setAutoFlush | public void setAutoFlush(bool) |
method | write | public void write(string) |
method | writeln | public void writeln(string) |
public TextWriter(Stream stream)
Create a TextWriter to write text to the specified stream. Use default buffer size (8K) and default chatset (ASCII). Also set autoFlush
to true.
Parameters
Throws
public TextWriter(Stream stream, string charset, int bufferSize, bool autoFlush)
Create a TextWriter to write text to the specified stream.
Parameters
Throws
public void close()
Flush the buffer and close the underlying stream.
public void flush()
Flush the writer by writing all bytes which are so far buffered into the target stream.
public void setAutoFlush(bool autoFlush)
Set whether to automatically flush everytime any of write methods is called.
Parameters
public void write(string text)
Write the text to the stream.
Parameters
public void writeln(string text)
Write the text, followed by an OS-specific line separator, to the stream.
Parameters