IXmlJsonReaderInitializer.SetInput 方法

定义

将支持 JavaScript 对象表示法 (JSON) 的读取器重新初始化为包含 JSON 编码数据的指定流或缓冲区。

重载

SetInput(Stream, Encoding, XmlDictionaryReaderQuotas, OnXmlDictionaryReaderClose)

将支持 JavaScript 对象表示法 (JSON) 的读取器重新初始化为包含 JSON 编码数据的指定流。

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

将支持 JavaScript 对象表示法 (JSON) 的读取器重新初始化为包含 JSON 编码数据的指定缓冲区。

注解

XmlDictionaryReader 方法之一创建的 CreateJsonReader 对象实现了此接口,这些对象可随时读取 JSON 编码数据。 但是,如果用户要重用相同的 XmlDictionaryReader 对象来读取其他 JSON 编码数据,则必须使用 SetInput 方法之一将读取器初始化为要读取的第二个数据集。

作为 MaxBytesPerRead 参数一部分设置的 quotas 值仅限制在使用 SetInput(Stream, Encoding, XmlDictionaryReaderQuotas, OnXmlDictionaryReaderClose) 方法从流中读取输入时读入内存的信息量,使用 SetInput(Byte[], Int32, Int32, Encoding, XmlDictionaryReaderQuotas, OnXmlDictionaryReaderClose) 方法从缓冲区中读取信息时不会强制实施该值。 可加载属性的数量限制与 JSON 上下文无关。

SetInput(Stream, Encoding, XmlDictionaryReaderQuotas, OnXmlDictionaryReaderClose)

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

将支持 JavaScript 对象表示法 (JSON) 的读取器重新初始化为包含 JSON 编码数据的指定流。

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)

参数

stream
Stream

要从中读取数据的输入 Stream

encoding
Encoding

读取器使用的 Encoding

onClose
OnXmlDictionaryReaderClose

读取器关闭时调用的委托。

注解

通过调用 XmlDictionaryReader 方法重新初始化读取 JSON 编码流的 SetInput(Stream, Encoding, XmlDictionaryReaderQuotas, OnXmlDictionaryReaderClose) 对象,可以重用该对象。

读取器可以解释 UTF-8 和 UTF-16(Little-Endian 或 Big-Endian)编码。 如果传递 1,则读取器在初始化时使用该编码集;如果传递 null,则自动检测编码。

作为 MaxBytesPerRead 参数一部分设置的 quotas 值仅限制在使用 SetInput(Stream, Encoding, XmlDictionaryReaderQuotas, OnXmlDictionaryReaderClose) 方法从流中读取输入时读入内存的信息量,使用 SetInput(Byte[], Int32, Int32, Encoding, XmlDictionaryReaderQuotas, OnXmlDictionaryReaderClose) 方法从缓冲区中读取信息时不会强制实施该值。 可加载属性的数量限制与 JSON 上下文无关。

适用于

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

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

将支持 JavaScript 对象表示法 (JSON) 的读取器重新初始化为包含 JSON 编码数据的指定缓冲区。

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)

参数

buffer
Byte[]

要从中读取数据的输入 Byte 缓冲区数组。

offset
Int32

buffer 中开始读取数据的位置。

count
Int32

可以从 buffer 中读取的字节数。

encoding
Encoding

读取器使用的 Encoding

onClose
OnXmlDictionaryReaderClose

在读取器关闭时调用的 OnXmlDictionaryReaderClose 委托。

注解

通过调用 XmlDictionaryReader 方法重新初始化读取 JSON 编码缓冲 ByteSetInput(Byte[], Int32, Int32, Encoding, XmlDictionaryReaderQuotas, OnXmlDictionaryReaderClose) 对象,可以重用该对象。

读取器可以解释 UTF-8 和 UTF-16(Little-Endian 或 Big-Endian)编码。 如果传递 1,则读取器在初始化时使用该编码集;如果传递 null,则自动检测编码。

作为 MaxBytesPerRead 参数一部分设置的 quotas 值仅限制在使用 SetInput(Stream, Encoding, XmlDictionaryReaderQuotas, OnXmlDictionaryReaderClose) 方法从流中读取输入时读入内存的信息量,使用 SetInput(Byte[], Int32, Int32, Encoding, XmlDictionaryReaderQuotas, OnXmlDictionaryReaderClose) 方法从缓冲区中读取信息时不会强制实施该值。 可加载属性的数量限制与 JSON 上下文无关。

适用于