| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * Input streams are used to read data sequentially from some data | 6 * Input streams are used to read data sequentially from some data |
| 7 * source. All input streams are non-blocking. They each have a number | 7 * source. All input streams are non-blocking. They each have a number |
| 8 * of read calls which will always return without any IO related | 8 * of read calls which will always return without any IO related |
| 9 * blocking. If the requested data is not available a read call will | 9 * blocking. If the requested data is not available a read call will |
| 10 * return [:null:]. All input streams have one or more handlers which | 10 * return [:null:]. All input streams have one or more handlers which |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 * Pipe the content of this input stream directly to the output | 60 * Pipe the content of this input stream directly to the output |
| 61 * stream [output]. The default behavior is to close the output when | 61 * stream [output]. The default behavior is to close the output when |
| 62 * all the data from the input stream have been written. Specifying | 62 * all the data from the input stream have been written. Specifying |
| 63 * [:false:] for the optional argument [close] keeps the output | 63 * [:false:] for the optional argument [close] keeps the output |
| 64 * stream open after writing all data from the input stream. The | 64 * stream open after writing all data from the input stream. The |
| 65 * default value for [close] is [:true:]. | 65 * default value for [close] is [:true:]. |
| 66 */ | 66 */ |
| 67 void pipe(OutputStream output, [bool close]); | 67 void pipe(OutputStream output, [bool close]); |
| 68 | 68 |
| 69 /** | 69 /** |
| 70 * Close the underlying communication channel to avoid getting any |
| 71 * more data. In normal situations, where all data is read from the |
| 72 * stream until the close handler is called, calling [close] is not |
| 73 * required. When [close] is used the close handler will still be |
| 74 * called. |
| 75 */ |
| 76 void close(); |
| 77 |
| 78 /** |
| 70 * Returns whether the stream is closed. There will be no more data | 79 * Returns whether the stream is closed. There will be no more data |
| 71 * to read. | 80 * to read. |
| 72 */ | 81 */ |
| 73 bool get closed(); | 82 bool get closed(); |
| 74 | 83 |
| 75 /** | 84 /** |
| 76 * Sets the handler that gets called when data is available. | 85 * Sets the handler that gets called when data is available. |
| 77 */ | 86 */ |
| 78 void set dataHandler(void callback()); | 87 void set dataHandler(void callback()); |
| 79 | 88 |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 void set errorHandler(void callback()); | 219 void set errorHandler(void callback()); |
| 211 } | 220 } |
| 212 | 221 |
| 213 | 222 |
| 214 class StreamException implements Exception { | 223 class StreamException implements Exception { |
| 215 const StreamException([String this.message = ""]); | 224 const StreamException([String this.message = ""]); |
| 216 const StreamException.streamClosed() : message = "Stream closed"; | 225 const StreamException.streamClosed() : message = "Stream closed"; |
| 217 String toString() => "StreamException: $message"; | 226 String toString() => "StreamException: $message"; |
| 218 final String message; | 227 final String message; |
| 219 } | 228 } |
| OLD | NEW |