blob: ce98722492d1fe2921a72df8077ee8f2f436c618 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
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>
|