IXmlJsonWriterInitializer.SetOutput(Stream, Encoding, Boolean) Method

Definition

Initializes (or reinitializes) a JavaScript Object Notation (JSON) writer to a specified output stream with specified character encoding.

public:
 void SetOutput(System::IO::Stream ^ stream, System::Text::Encoding ^ encoding, bool ownsStream);
public void SetOutput (System.IO.Stream stream, System.Text.Encoding encoding, bool ownsStream);
abstract member SetOutput : System.IO.Stream * System.Text.Encoding * bool -> unit
Public Sub SetOutput (stream As Stream, encoding As Encoding, ownsStream As Boolean)

Parameters

stream
Stream

The output Stream to which the writer writes.

encoding
Encoding

The Encoding that specifies the character encoding of the output stream.

ownsStream
Boolean

If true, the output stream is closed by the writer when done; otherwise false.

Remarks

The XmlDictionaryWriter objects created by the CreateJsonWriter methods implement this interface and when created are immediately ready to write JSON-encoded data. But if a user wants to reuse the same XmlDictionaryWriter object to write a new JSON document to another output stream, then the writer must be initialized to the appropriate stream by using the SetOutput(Stream, Encoding, Boolean) method.

The writers created by JsonReaderWriterFactory can handle the UTF-8 and the UTF-16 (big- or little-endian) encodings.

Applies to