語言

IXmlJsonReaderInitializer.SetInput 方法

定義

重新初始化支援 JavaScript 物件符號(JSON)的讀取器,以初始化包含 JSON 編碼資料的特定串流或緩衝區。

多載

名稱 Description
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)

來源:
IXmlJsonReaderInitializer.cs
來源:
IXmlJsonReaderInitializer.cs
來源:
IXmlJsonReaderInitializer.cs
來源:
IXmlJsonReaderInitializer.cs
來源:
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

請委託人在讀書室關閉時致電。

備註

讀取 JSON 編碼串流的 XmlDictionaryReader 物件可以透過呼叫 SetInput(Stream, Encoding, XmlDictionaryReaderQuotas, OnXmlDictionaryReaderClose) 該方法重新初始化來重複使用。

讀者可以解讀 UTF-8 和 UTF-16(大端序或小端序)編碼。 讀取器在初始化時使用編碼集(若傳入),或自動偵測 null 該編碼。

MaxBytesPerRead參數中設定quotas的值僅限制在使用SetInput(Stream, Encoding, XmlDictionaryReaderQuotas, OnXmlDictionaryReaderClose)該方法從串流讀取輸入時,讀取到記憶體的資訊量,且在使用該方法從緩衝區讀取資訊時SetInput(Byte[], Int32, Int32, Encoding, XmlDictionaryReaderQuotas, OnXmlDictionaryReaderClose)不會強制執行。 可載入屬性數量的限制與 JSON 上下文無關。

適用於

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

來源:
IXmlJsonReaderInitializer.cs
來源:
IXmlJsonReaderInitializer.cs
來源:
IXmlJsonReaderInitializer.cs
來源:
IXmlJsonReaderInitializer.cs
來源:
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 編碼緩衝區Byte的物件,可以透過呼叫SetInput(Byte[], Int32, Int32, Encoding, XmlDictionaryReaderQuotas, OnXmlDictionaryReaderClose)該方法重新初始化來重複使用。

讀者可以解讀 UTF-8 和 UTF-16(大端序或小端序)編碼。 讀取器在初始化時使用編碼集(若傳入),或自動偵測 null 該編碼。

MaxBytesPerRead參數中設定quotas的值僅限制在使用SetInput(Stream, Encoding, XmlDictionaryReaderQuotas, OnXmlDictionaryReaderClose)該方法從串流讀取輸入時,讀取到記憶體的資訊量,且在使用該方法從緩衝區讀取資訊時SetInput(Byte[], Int32, Int32, Encoding, XmlDictionaryReaderQuotas, OnXmlDictionaryReaderClose)不會強制執行。 可載入屬性數量的限制與 JSON 上下文無關。

適用於