System::IO::StreamWriter class

StreamWriter class

Represents a writer that writes characters to a byte stream. Objects of this class should only be allocated using System::MakeObject() function. Never create instance of this type on stack or using operator new, as it will result in runtime errors and/or assertion faults. Always wrap this class into System::SmartPtr pointer and use this pointer to pass it to functions as argument.

class StreamWriter : public System::IO::TextWriter

Methods

MethodDescription
Close() overrideCloses the stream and releases aquired resources.
Dispose() overrideReleases all resources used by the current object and closes the undelying stream.
Flush() overrideFlushes the content of the buffer to the underlying stream and then flushes the underlying stream.
get_AutoFlush() constReturns a value that indicates whether the StreamWriter will flush the data to the underlying stream every time method StreamWriter::Write is called.
get_BaseStream() constReturns a shared pointer to an object that represents the underlying stream.
get_Encoding() overrideReturns the currently used encoding.
set_AutoFlush(bool)Returns a value that specifies whether the StreamWriter should flush the data to the underlying stream every time method StreamWriter::Write is called.
StreamWriter(const SharedPtr<Stream>&)Constructs an instance of StreamWriter object that writes characters to the specified underlying stream using UTF-8 encoding and a buffer with default size of 1024 bytes.
StreamWriter(const SharedPtr<Stream>&, const EncodingPtr&)Constructs an instance of StreamWriter object that writes characters to the specified underlying stream using the specified encoding and a buffer with default size of 1024 bytes.
StreamWriter(const SharedPtr<Stream>&, const EncodingPtr&, int, bool)Constructs an instance of StreamWriter object that writes characters to the specified underlying stream using the specified encoding and a buffer of the specified size. A parameter specifies whether the underlying stream should be closed when the StreamWriter object is disposed.
StreamWriter(const String&)Constructs an instance of StreamWriter object that writes characters to the specified file using UTF-8 encoding and a buffer with default size of 1024 bytes.
StreamWriter(const String&, bool, const EncodingPtr&)Constructs an instance of StreamWriter object that writes characters to the specified file using the specified encoding and a buffer with default size of 1024 bytes. A parameter specifies whether the data should be appened to the file or the file should be overwritten.
StreamWriter(const String&, bool, const EncodingPtr&, int)Constructs an instance of StreamWriter object that writes characters to the specified file using the specified encoding and buffer size. A parameter specifies whether the data should be appened to the file or the file should be overwritten.
Write(char_t) overrideWrites the specified character to the stream.
Write(const String&) overrideWrites the specified string to the stream.
Write(const SharedPtr<Object>&) overrideWrites the string representation of the specified object to the stream.
Write(const ArrayPtr<char_t>&) overrideWrites all characetrs from the specified array to the stream.
Write(const ArrayPtr<char_t>&, int32_t, int32_t) overrideWrites the specified subrange of UTF-16 characters from the specified character array to the stream.
Write(const char_t *) overrideWrites the specified c-string to the stream.
Write(const System::SharedPtr<T>&)Writes the string representation of the specified object to the stream.
WriteLine() overrideWrites line terminator characters to the stream.
WriteLine(const String&) overrideWrites the specified string followed by the line-terminating characters to the stream.
WriteLine(const SharedPtr<Object>&) overrideWrites the string representation of the specified object followed by the line-terminating characters to the stream.
WriteLine(const ArrayPtr<char_t>&) overrideWrites all characetrs from the specified array followed by the line-terminating characters to the stream.
WriteLine(const ArrayPtr<char_t>&, int32_t, int32_t) overrideWrites the specified subrange of UTF-16 characters from the specified character array followed by the line-terminating characters to the stream.
WriteLine(const char_t *) overrideWrites the specified c-string followed by the line-terminating characters to the stream.
WriteLine(const System::SharedPtr<T>&)Writes the string representation of the specified object followed by the line-terminating characters to the stream.
~StreamWriter()Destructor.

See Also