diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
commit | 33058f2b292b3a581333bdfb21b8f671898c5060 (patch) | |
tree | 51c3e392513ec574331b2d3f85c394445ea803c6 /files/ja/mozilla/tech/xpcom/reference/components/nsscriptableinputstream/index.html | |
parent | 8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff) | |
download | translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2 translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip |
initial commit
Diffstat (limited to 'files/ja/mozilla/tech/xpcom/reference/components/nsscriptableinputstream/index.html')
-rw-r--r-- | files/ja/mozilla/tech/xpcom/reference/components/nsscriptableinputstream/index.html | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/files/ja/mozilla/tech/xpcom/reference/components/nsscriptableinputstream/index.html b/files/ja/mozilla/tech/xpcom/reference/components/nsscriptableinputstream/index.html new file mode 100644 index 0000000000..ce98722492 --- /dev/null +++ b/files/ja/mozilla/tech/xpcom/reference/components/nsscriptableinputstream/index.html @@ -0,0 +1,66 @@ +--- +title: nsScriptableInputStream +slug: Mozilla/Tech/XPCOM/Reference/Components/nsScriptableInputStream +tags: + - Components + - 'Components:Frozen' + - XPCOM + - XPCOM API Reference +translation_of: Mozilla/Tech/XPCOM/Reference/Components/nsScriptableInputStream +--- +<p>« <a href="/ja/docs/XPCOM_API_Reference">XPCOM API Reference</a></p> + +<h3 id=".E8.A6.81.E7.B4.84" name=".E8.A6.81.E7.B4.84">要約</h3> + +<p><code><a href="ja/NsIScriptableInputStream">nsIScriptableInputStream</a></code> を実装するコンポーネント。</p> + +<dl> + <dt>Class ID</dt> + <dd><code>7225c040-a9bf-11d3-a197-0050041caf44</code></dd> + <dt>ContractID</dt> + <dd><code>@mozilla.org/scriptableinputstream;1</code></dd> +</dl> + +<h3 id=".E3.82.B5.E3.83.9D.E3.83.BC.E3.83.88.E3.81.95.E3.82.8C.E3.81.9F.E3.82.A4.E3.83.B3.E3.82.BF.E3.83.95.E3.82.A7.E3.83.BC.E3.82.B9" name=".E3.82.B5.E3.83.9D.E3.83.BC.E3.83.88.E3.81.95.E3.82.8C.E3.81.9F.E3.82.A4.E3.83.B3.E3.82.BF.E3.83.95.E3.82.A7.E3.83.BC.E3.82.B9">サポートされたインタフェース</h3> + +<p><code><a href="ja/NsIScriptableInputStream">nsIScriptableInputStream</a></code>, <code><a href="ja/NsIInputStream">nsIInputStream</a></code></p> + +<h3 id=".E3.82.B3.E3.83.A1.E3.83.B3.E3.83.88" name=".E3.82.B3.E3.83.A1.E3.83.B3.E3.83.88">コメント</h3> + +<p>このコンポーネントは XPCOM コンポーネントマネージャを通してアクセスします。</p> + +<h3 id=".E3.82.B3.E3.83.BC.E3.83.89.E4.BE.8B" name=".E3.82.B3.E3.83.BC.E3.83.89.E4.BE.8B">コード例</h3> + +<pre>const nsIScriptableInputStream = Components.interfaces.nsIScriptableInputStream; + +function consumeStream(inputStream) +{ + var factory = Components.classes["@mozilla.org/scriptableinputstream;1"]; + + var sis = factory.createInstance(nsIScriptableInputStream); + sis.init(inputStream); + + try + { + while (true) + { + var chunk = sis.read(512); + if (chunk.length == 0) + break; + + // ok, chunk now contains a portion of the stream's data. + // Do something with it! + } + } + catch (e) + { + dump("Error: failed reading from stream:\n" + e + "\n"); + } +} +</pre> + +<h3 id=".E5.8F.82.E8.80.83" name=".E5.8F.82.E8.80.83">参考</h3> + +<p><a href="ja/NsIScriptableInputStream">nsIScriptableInputStream</a></p> + +<div class="noinclude"> </div> |