Muokkaa

Jaa


IXmlJsonReaderInitializer.SetInput Method

Definition

Reinitializes a JavaScript Object Notation (JSON) enabled reader to a specified stream or buffer that contains JSON-encoded data.

Overloads

SetInput(Stream, Encoding, XmlDictionaryReaderQuotas, OnXmlDictionaryReaderClose)

Reinitializes a JavaScript Object Notation (JSON) enabled reader to a specified stream that contains JSON-encoded data.

SetInput(Byte[], Int32, Int32, Encoding, XmlDictionaryReaderQuotas, OnXmlDictionaryReaderClose)

Reinitializes a JavaScript Object Notation (JSON) enabled reader to a specified buffer that contains JSON-encoded data.

Remarks

The XmlDictionaryReader objects created by one of the CreateJsonReader methods implement this interface and are ready to read JSON-encoded data. But if a user wants to reuse the same XmlDictionaryReader object to read other JSON-encoded data, then the reader must be initialized to the second dataset to be read by using the one of the SetInput methods.

The MaxBytesPerRead value set as part of the quotas parameter only limits the amount of information being read into memory when the input is being read from a stream with the SetInput(Stream, Encoding, XmlDictionaryReaderQuotas, OnXmlDictionaryReaderClose) method and is not enforced when the SetInput(Byte[], Int32, Int32, Encoding, XmlDictionaryReaderQuotas, OnXmlDictionaryReaderClose) method is used to read information from a buffer. The limits on the number of attributes that can be loaded are not relevant to the JSON context.

SetInput(Stream, Encoding, XmlDictionaryReaderQuotas, OnXmlDictionaryReaderClose)

Source:
IXmlJsonReaderInitializer.cs
Source:
IXmlJsonReaderInitializer.cs
Source:
IXmlJsonReaderInitializer.cs

Reinitializes a JavaScript Object Notation (JSON) enabled reader to a specified stream that contains JSON-encoded data.

public:
 void SetInput(System::IO::Stream ^ stream, System::Text::Encoding ^ encoding, System::Xml::XmlDictionaryReaderQuotas ^ quotas, System::Xml::OnXmlDictionaryReaderClose ^ onClose);
public void SetInput (System.IO.Stream stream, System.Text.Encoding? encoding, System.Xml.XmlDictionaryReaderQuotas quotas, System.Xml.OnXmlDictionaryReaderClose? onClose);
public void SetInput (System.IO.Stream stream, System.Text.Encoding encoding, System.Xml.XmlDictionaryReaderQuotas quotas, System.Xml.OnXmlDictionaryReaderClose onClose);
abstract member SetInput : System.IO.Stream * System.Text.Encoding * System.Xml.XmlDictionaryReaderQuotas * System.Xml.OnXmlDictionaryReaderClose -> unit
Public Sub SetInput (stream As Stream, encoding As Encoding, quotas As XmlDictionaryReaderQuotas, onClose As OnXmlDictionaryReaderClose)

Parameters

stream
Stream

The input Stream from which to read.

encoding
Encoding

The Encoding used by the reader.

onClose
OnXmlDictionaryReaderClose

Delegate to call when the reader is closed.

Remarks

A XmlDictionaryReader object that reads JSON-encoded streams can be reused by calling the SetInput(Stream, Encoding, XmlDictionaryReaderQuotas, OnXmlDictionaryReaderClose) method to reinitialize it.

The reader can interpret the UTF-8 and the UTF-16 (big- or little-endian) encodings. The reader uses the encoding set at initialization time if one is passed or the encoding is automatically detected if null is passed.

The MaxBytesPerRead value set as part of the quotas parameter only limits the amount of information being read into memory when the input is being read from a stream with the SetInput(Stream, Encoding, XmlDictionaryReaderQuotas, OnXmlDictionaryReaderClose) method and is not enforced when the SetInput(Byte[], Int32, Int32, Encoding, XmlDictionaryReaderQuotas, OnXmlDictionaryReaderClose) method is used to read information from a buffer. The limits on the number of attributes that can be loaded are not relevant to the JSON context.

Applies to

SetInput(Byte[], Int32, Int32, Encoding, XmlDictionaryReaderQuotas, OnXmlDictionaryReaderClose)

Source:
IXmlJsonReaderInitializer.cs
Source:
IXmlJsonReaderInitializer.cs
Source:
IXmlJsonReaderInitializer.cs

Reinitializes a JavaScript Object Notation (JSON) enabled reader to a specified buffer that contains JSON-encoded data.

public:
 void SetInput(cli::array <System::Byte> ^ buffer, int offset, int count, System::Text::Encoding ^ encoding, System::Xml::XmlDictionaryReaderQuotas ^ quotas, System::Xml::OnXmlDictionaryReaderClose ^ onClose);
public void SetInput (byte[] buffer, int offset, int count, System.Text.Encoding? encoding, System.Xml.XmlDictionaryReaderQuotas quotas, System.Xml.OnXmlDictionaryReaderClose? onClose);
public void SetInput (byte[] buffer, int offset, int count, System.Text.Encoding encoding, System.Xml.XmlDictionaryReaderQuotas quotas, System.Xml.OnXmlDictionaryReaderClose onClose);
abstract member SetInput : byte[] * int * int * System.Text.Encoding * System.Xml.XmlDictionaryReaderQuotas * System.Xml.OnXmlDictionaryReaderClose -> unit
Public Sub SetInput (buffer As Byte(), offset As Integer, count As Integer, encoding As Encoding, quotas As XmlDictionaryReaderQuotas, onClose As OnXmlDictionaryReaderClose)

Parameters

buffer
Byte[]

The input Byte buffer array from which to read.

offset
Int32

The starting position from which to read in buffer.

count
Int32

The number of bytes that can be read from buffer.

encoding
Encoding

The Encoding used by the reader.

onClose
OnXmlDictionaryReaderClose

The OnXmlDictionaryReaderClose delegate to call when the reader is closed.

Remarks

A XmlDictionaryReader object that reads a JSON-encoded buffered Byte can be reused by calling the SetInput(Byte[], Int32, Int32, Encoding, XmlDictionaryReaderQuotas, OnXmlDictionaryReaderClose) method to reinitialize it.

The reader can interpret the UTF-8 and the UTF-16 (big- or little-endian) encodings. The reader uses the encoding set at initialization time if one is passed or the encoding is automatically detected if null is passed.

The MaxBytesPerRead value set as part of the quotas parameter only limits the amount of information being read into memory when the input is being read from a stream with the SetInput(Stream, Encoding, XmlDictionaryReaderQuotas, OnXmlDictionaryReaderClose) method and is not enforced when the SetInput(Byte[], Int32, Int32, Encoding, XmlDictionaryReaderQuotas, OnXmlDictionaryReaderClose) method is used to read information from a buffer. The limits on the number of attributes that can be loaded are not relevant to the JSON context.

Applies to