Constructors: NewStreamWriter

NewStreamWriter

Creates a new StreamWriter with either a filename or other stream as a source to write to in the specified Encoding.



 Public Function NewStreamWriter(
	  ByRef Source As Variant,
	  Optional ByVal Append As Boolean = False,
	  Optional ByVal Encoding As Encoding,
	  Optional ByVal BufferSize As Long = 4096,
	  Optional ByVal LeaveOpen As Boolean ) As StreamWriter

Parameters

Source
[ByRef] Variant. Either a file name or Stream object to write to.
Append
[ByVal] Optional. Boolean. Indicates if a file is to be appended to or overwritten.  

Default: False

Encoding
[ByVal] Optional. Encoding. The encoding to be used when writing to the stream.
BufferSize
[ByVal] Optional. Long. The minimum size of the internal buffer used to cache writes.  

Default: 4096

LeaveOpen
[ByVal] Optional. Boolean. True to leave the stream open after the StreamWriter object is disposed; otherwise, False.

Return Values

StreamWriter -  A new StreamWriter ready to write to an underlying stream in the specified Encoding.

Remarks

If a file name is passed in, then a FileStream is created internally using either FileMode.Create or FileMode.Append depending on Append.

If Encoding is not supplied, then an encoding of NewUTF8Encoding(False, True) is used.

See Also

Project CorLib Overview

Class Constructors Overview