| 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 13 matching lines...) Expand all Loading... |
| 24 * specified the length of [buffer] is used. | 24 * specified the length of [buffer] is used. |
| 25 */ | 25 */ |
| 26 int readInto(List<int> buffer, [int offset, int len]); | 26 int readInto(List<int> buffer, [int offset, int len]); |
| 27 | 27 |
| 28 /** | 28 /** |
| 29 * Returns the number of bytes available for immediate reading. | 29 * Returns the number of bytes available for immediate reading. |
| 30 */ | 30 */ |
| 31 int available(); | 31 int available(); |
| 32 | 32 |
| 33 /** | 33 /** |
| 34 * Returns whether the stream has been closed. There might still be | 34 * Returns whether the stream is closed. There will be no more data |
| 35 * more data to read. | 35 * to read. |
| 36 */ | 36 */ |
| 37 bool closed(); | 37 bool get closed(); |
| 38 | 38 |
| 39 /** | 39 /** |
| 40 * Sets the data which handler gets called when data is available. | 40 * Sets the data handler which 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 * The close handler gets called when the underlying communication | 45 * Sets the close handler which gets called when there will be no more |
| 46 * channel is closed and no more data will become available. Not all | 46 * data available in the stream. |
| 47 * types of communication channels will emit close events. | |
| 48 */ | 47 */ |
| 49 void set closeHandler(void callback()); | 48 void set closeHandler(void callback()); |
| 50 | 49 |
| 51 /** | 50 /** |
| 52 * The error handler gets called when the underlying communication | 51 * The error handler gets called when the underlying communication |
| 53 * channel gets into some kind of error situation. | 52 * channel gets into some kind of error situation. |
| 54 */ | 53 */ |
| 55 void set errorHandler(void callback()); | 54 void set errorHandler(void callback()); |
| 56 } | 55 } |
| 57 | 56 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 */ | 104 */ |
| 106 void set errorHandler(void callback()); | 105 void set errorHandler(void callback()); |
| 107 } | 106 } |
| 108 | 107 |
| 109 | 108 |
| 110 class StreamException implements Exception { | 109 class StreamException implements Exception { |
| 111 const StreamException([String this.message = ""]); | 110 const StreamException([String this.message = ""]); |
| 112 String toString() => "StreamException: $message"; | 111 String toString() => "StreamException: $message"; |
| 113 final String message; | 112 final String message; |
| 114 } | 113 } |
| OLD | NEW |