| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 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 | 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 * Basic input stream which supplies binary data. | 6 * Basic input stream which supplies binary data. |
| 7 * | 7 * |
| 8 * Input streams are used to read data sequentially from some data | 8 * Input streams are used to read data sequentially from some data |
| 9 * source. All input streams are non-blocking. They each have a number | 9 * source. All input streams are non-blocking. They each have a number |
| 10 * of read calls which will always return without any IO related | 10 * of read calls which will always return without any IO related |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 /** | 88 /** |
| 89 * Sets the handler that gets called when there will be no more data | 89 * Sets the handler that gets called when there will be no more data |
| 90 * available in the stream. | 90 * available in the stream. |
| 91 */ | 91 */ |
| 92 void set onClosed(void callback()); | 92 void set onClosed(void callback()); |
| 93 | 93 |
| 94 /** | 94 /** |
| 95 * Sets the handler that gets called when the underlying | 95 * Sets the handler that gets called when the underlying |
| 96 * communication channel gets into some kind of error situation. | 96 * communication channel gets into some kind of error situation. |
| 97 */ | 97 */ |
| 98 void set onError(void callback(Exception e)); | 98 void set onError(void callback(e)); |
| 99 } | 99 } |
| 100 | 100 |
| 101 | 101 |
| 102 /** | 102 /** |
| 103 * String encodings supported by [StringInputStream] and | 103 * String encodings supported by [StringInputStream] and |
| 104 * [StringOutputStream]. | 104 * [StringOutputStream]. |
| 105 */ | 105 */ |
| 106 class Encoding { | 106 class Encoding { |
| 107 static final Encoding UTF_8 = const Encoding._internal("UTF-8"); | 107 static final Encoding UTF_8 = const Encoding._internal("UTF-8"); |
| 108 static final Encoding ISO_8859_1 = const Encoding._internal("ISO-8859-1"); | 108 static final Encoding ISO_8859_1 = const Encoding._internal("ISO-8859-1"); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 /** | 175 /** |
| 176 * Sets the handler that gets called when there will be no more data | 176 * Sets the handler that gets called when there will be no more data |
| 177 * available in the stream. | 177 * available in the stream. |
| 178 */ | 178 */ |
| 179 void set onClosed(void callback()); | 179 void set onClosed(void callback()); |
| 180 | 180 |
| 181 /** | 181 /** |
| 182 * Sets the handler that gets called when the underlying | 182 * Sets the handler that gets called when the underlying |
| 183 * communication channel gets into some kind of error situation. | 183 * communication channel gets into some kind of error situation. |
| 184 */ | 184 */ |
| 185 void set onError(void callback(Exception e)); | 185 void set onError(void callback(e)); |
| 186 } | 186 } |
| 187 | 187 |
| 188 | 188 |
| 189 /** | 189 /** |
| 190 * A chunked input stream wraps a basic input stream and supplies | 190 * A chunked input stream wraps a basic input stream and supplies |
| 191 * binary data in configurable chunk sizes. | 191 * binary data in configurable chunk sizes. |
| 192 */ | 192 */ |
| 193 interface ChunkedInputStream default _ChunkedInputStream { | 193 interface ChunkedInputStream default _ChunkedInputStream { |
| 194 /** | 194 /** |
| 195 * Adds buffering to an input stream and provide the ability to read | 195 * Adds buffering to an input stream and provide the ability to read |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 /** | 230 /** |
| 231 * Sets the handler that gets called when there will be no more data | 231 * Sets the handler that gets called when there will be no more data |
| 232 * available in the stream. | 232 * available in the stream. |
| 233 */ | 233 */ |
| 234 void set onClosed(void callback()); | 234 void set onClosed(void callback()); |
| 235 | 235 |
| 236 /** | 236 /** |
| 237 * Sets the handler that gets called when the underlying | 237 * Sets the handler that gets called when the underlying |
| 238 * communication channel gets into some kind of error situation. | 238 * communication channel gets into some kind of error situation. |
| 239 */ | 239 */ |
| 240 void set onError(void callback(Exception e)); | 240 void set onError(void callback(e)); |
| 241 } | 241 } |
| 242 | 242 |
| 243 | 243 |
| 244 class StreamException implements Exception { | 244 class StreamException implements Exception { |
| 245 const StreamException([String this.message = ""]); | 245 const StreamException([String this.message = ""]); |
| 246 const StreamException.streamClosed() : message = "Stream closed"; | 246 const StreamException.streamClosed() : message = "Stream closed"; |
| 247 String toString() => "StreamException: $message"; | 247 String toString() => "StreamException: $message"; |
| 248 final String message; | 248 final String message; |
| 249 } | 249 } |
| OLD | NEW |