语言

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
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通过调用SetInput(Stream, Encoding, XmlDictionaryReaderQuotas, OnXmlDictionaryReaderClose)方法来重新初始化 JSON 编码流,可以重复使用读取 JSON 编码流的对象。

读取器可以解释 UTF-8 和 UTF-16(big-or little-endian)编码。 读取器在初始化时使用编码集(如果传递了编码),或者如果 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
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可以通过调用Byte方法重新初始化它来重用读取 JSON 编码缓冲SetInput(Byte[], Int32, Int32, Encoding, XmlDictionaryReaderQuotas, OnXmlDictionaryReaderClose)的对象。

读取器可以解释 UTF-8 和 UTF-16(big-or little-endian)编码。 读取器在初始化时使用编码集(如果传递了编码),或者如果 null 传递了编码,则会自动检测到编码。

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

适用于