| 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 is read from a given input stream. Such an input stream can | 6 * Input is read from a given input stream. Such an input stream can |
| 7 * be an endpoint, e.g., a socket or a file, or another input stream. | 7 * be an endpoint, e.g., a socket or a file, or another input stream. |
| 8 * Multiple input streams can be chained together to operate collaboratively | 8 * Multiple input streams can be chained together to operate collaboratively |
| 9 * on a given input. | 9 * on a given input. |
| 10 */ | 10 */ |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 */ | 30 */ |
| 31 int available(); | 31 int available(); |
| 32 | 32 |
| 33 /** | 33 /** |
| 34 * Returns whether the stream is closed. There will be no more data | 34 * Returns whether the stream is closed. There will be no more data |
| 35 * to read. | 35 * to read. |
| 36 */ | 36 */ |
| 37 bool get closed(); | 37 bool get closed(); |
| 38 | 38 |
| 39 /** | 39 /** |
| 40 * Sets the data handler which gets called when data is available. | 40 * Sets the handler that gets called when data is available. |
| 41 */ | 41 */ |
| 42 void set dataHandler(void callback()); | 42 void set dataHandler(void callback()); |
| 43 | 43 |
| 44 /** | 44 /** |
| 45 * Sets the close handler which gets called when there will be no more | 45 * Sets the handler that gets called when there will be no more data |
| 46 * data available in the stream. | 46 * available in the stream. |
| 47 */ | 47 */ |
| 48 void set closeHandler(void callback()); | 48 void set closeHandler(void callback()); |
| 49 | 49 |
| 50 /** | 50 /** |
| 51 * The error handler gets called when the underlying communication | 51 * Sets the handler that gets called when the underlying |
| 52 * channel gets into some kind of error situation. | 52 * communication channel gets into some kind of error situation. |
| 53 */ | 53 */ |
| 54 void set errorHandler(void callback()); | 54 void set errorHandler(void callback()); |
| 55 } | 55 } |
| 56 | 56 |
| 57 | 57 |
| 58 interface StringInputStream factory _StringInputStream { | 58 interface StringInputStream factory _StringInputStream { |
| 59 /** | 59 /** |
| 60 * Decodes a binary input stream into characters using the specified | 60 * Decodes a binary input stream into characters using the specified |
| 61 * encoding. | 61 * encoding. |
| 62 */ | 62 */ |
| (...skipping 17 matching lines...) Expand all Loading... |
| 80 * more data to read. | 80 * more data to read. |
| 81 */ | 81 */ |
| 82 bool get closed(); | 82 bool get closed(); |
| 83 | 83 |
| 84 /** | 84 /** |
| 85 * Returns the encoding used to decode the binary data into characters. | 85 * Returns the encoding used to decode the binary data into characters. |
| 86 */ | 86 */ |
| 87 String get encoding(); | 87 String get encoding(); |
| 88 | 88 |
| 89 /** | 89 /** |
| 90 * The data handler gets called when data is available. | 90 * Sets the handler that gets called when data is available. |
| 91 */ | 91 */ |
| 92 void set dataHandler(void callback()); | 92 void set dataHandler(void callback()); |
| 93 | 93 |
| 94 /** | 94 /** |
| 95 * The close handler gets called when the underlying communication | 95 * Sets the handler that gets called when there will be no more data |
| 96 * channel is closed and no more data will become available. Not all | 96 * available in the stream. |
| 97 * types of communication channels will emit close events. | |
| 98 */ | 97 */ |
| 99 void set closeHandler(void callback()); | 98 void set closeHandler(void callback()); |
| 100 | 99 |
| 101 /** | 100 /** |
| 102 * The error handler gets called when the underlying communication | 101 * Sets the handler that gets called when the underlying |
| 103 * channel gets into some kind of error situation. | 102 * communication channel gets into some kind of error situation. |
| 104 */ | 103 */ |
| 105 void set errorHandler(void callback()); | 104 void set errorHandler(void callback()); |
| 106 } | 105 } |
| 107 | 106 |
| 108 | 107 |
| 109 class StreamException implements Exception { | 108 class StreamException implements Exception { |
| 110 const StreamException([String this.message = ""]); | 109 const StreamException([String this.message = ""]); |
| 111 String toString() => "StreamException: $message"; | 110 String toString() => "StreamException: $message"; |
| 112 final String message; | 111 final String message; |
| 113 } | 112 } |
| OLD | NEW |