OLD | NEW |
| (Empty) |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | |
2 // for details. All rights reserved. Use of this source code is governed by a | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 | |
5 part of dart.io; | |
6 | |
7 /** | |
8 * [ListInputStream] makes it possible to use the [InputStream] | |
9 * interface to stream over data that is received in chunks as lists | |
10 * of integers. | |
11 * | |
12 * When a new list of integers is received it can be written to the | |
13 * [ListInputStream] using the [write] method. The [markEndOfStream] | |
14 * method must be called when the last data has been written to the | |
15 * [ListInputStream]. | |
16 */ | |
17 abstract class ListInputStream implements InputStream { | |
18 /** | |
19 * Create an empty [ListInputStream] to which data can be written | |
20 * using the [write] method. | |
21 */ | |
22 factory ListInputStream() => new _ListInputStream(); | |
23 | |
24 /** | |
25 * Write more data to be streamed over to the [ListInputStream]. | |
26 */ | |
27 void write(List<int> data); | |
28 | |
29 /** | |
30 * Notify the [ListInputStream] that no more data will be written to | |
31 * it. | |
32 */ | |
33 void markEndOfStream(); | |
34 } | |
35 | |
36 | |
37 /** | |
38 * [ListOutputStream] makes it possible to use the [OutputStream] | |
39 * interface to write data to a [List] of integers. | |
40 */ | |
41 abstract class ListOutputStream implements OutputStream { | |
42 /** | |
43 * Create a [ListOutputStream]. | |
44 */ | |
45 factory ListOutputStream() => new _ListOutputStream(); | |
46 | |
47 /** | |
48 * Reads all available data from the stream. If no data is available `null` | |
49 * will be returned. | |
50 */ | |
51 List<int> read(); | |
52 | |
53 /** | |
54 * Sets the handler that gets called when data is available. | |
55 */ | |
56 void set onData(void callback()); | |
57 } | |
OLD | NEW |