blob: f7cffe8c85f64f1199fb540ef012f1d54e115492 (
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
|
<!-- contributed by Drew Willcoxon [adw@mozilla.com] -->
<!-- edited by Noelle Murata [fiveinchpixie@gmail.com] -->
The `byte-streams` module provides streams for reading and writing bytes.
<api name="ByteReader">
@class
<api name="ByteReader">
@constructor
Creates a binary input stream that reads bytes from a backing stream.
@param inputStream {stream}
The backing stream, an <a href="http://mxr.mozilla.org/mozilla-central/
source/xpcom/io/nsIInputStream.idl"><code>nsIInputStream</code></a>.
</api>
<api name="closed">
@property {boolean}
True if the stream is closed.
</api>
<api name="close">
@method
Closes both the stream and its backing stream. If the stream is already
closed, an exception is thrown.
</api>
<api name="read">
@method
Reads a string from the stream. If the stream is closed, an exception is
thrown.
@param [numBytes] {number}
The number of bytes to read. If not given, the remainder of the entire stream
is read.
@returns {string}
A string containing the bytes read. If the stream is at the end, returns the
empty string.
</api>
</api>
<api name="ByteWriter">
@class
<api name="ByteWriter">
@constructor
Creates a binary output stream that writes bytes to a backing stream.
@param outputStream {stream}
The backing stream, an <a href="http://mxr.mozilla.org/mozilla-central/
source/xpcom/io/nsIOutputStream.idl"><code>nsIOutputStream</code></a>.
</api>
<api name="closed">
@property {boolean}
True if the stream is closed.
</api>
<api name="close">
@method
Closes both the stream and its backing stream. If the stream is already
closed, an exception is thrown.
</api>
<api name="write">
@method
Writes a string to the stream. If the stream is closed, an exception is
thrown.
@param str {string}
The string to write.
</api>
</api>
|