IXmlJsonWriterInitializer.SetOutput(Stream, Encoding, Boolean) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
- 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.