| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 part of dart.async; | 5 part of dart.async; |
| 6 | 6 |
| 7 // ------------------------------------------------------------------- | 7 // ------------------------------------------------------------------- |
| 8 // Core Stream types | 8 // Core Stream types |
| 9 // ------------------------------------------------------------------- | 9 // ------------------------------------------------------------------- |
| 10 | 10 |
| (...skipping 1156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1167 abstract class StreamSubscription<T> { | 1167 abstract class StreamSubscription<T> { |
| 1168 /** | 1168 /** |
| 1169 * Cancels this subscription. It will no longer receive events. | 1169 * Cancels this subscription. It will no longer receive events. |
| 1170 * | 1170 * |
| 1171 * May return a future which completes when the stream is done cleaning up. | 1171 * May return a future which completes when the stream is done cleaning up. |
| 1172 * This can be used if the stream needs to release some resources | 1172 * This can be used if the stream needs to release some resources |
| 1173 * that are needed for a following operation, | 1173 * that are needed for a following operation, |
| 1174 * for example a file being read, that should be deleted afterwards. | 1174 * for example a file being read, that should be deleted afterwards. |
| 1175 * In that case, the file may not be able to be deleted successfully | 1175 * In that case, the file may not be able to be deleted successfully |
| 1176 * until the returned future has completed. | 1176 * until the returned future has completed. |
| 1177 * |
| 1178 * The future will be completed with a `null` value. |
| 1179 * If the cleanup throws, which it really shouldn't, the returned future |
| 1180 * will be completed with that error. |
| 1181 * |
| 1177 * Returns `null` if there is no need to wait. | 1182 * Returns `null` if there is no need to wait. |
| 1178 */ | 1183 */ |
| 1179 Future cancel(); | 1184 Future cancel(); |
| 1180 | 1185 |
| 1181 /** Set or override the data event handler of this subscription. */ | 1186 /** Set or override the data event handler of this subscription. */ |
| 1182 void onData(void handleData(T data)); | 1187 void onData(void handleData(T data)); |
| 1183 | 1188 |
| 1184 /** | 1189 /** |
| 1185 * Set or override the error event handler of this subscription. | 1190 * Set or override the error event handler of this subscription. |
| 1186 * | 1191 * |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1484 class _ControllerEventSinkWrapper<T> implements EventSink<T> { | 1489 class _ControllerEventSinkWrapper<T> implements EventSink<T> { |
| 1485 EventSink _sink; | 1490 EventSink _sink; |
| 1486 _ControllerEventSinkWrapper(this._sink); | 1491 _ControllerEventSinkWrapper(this._sink); |
| 1487 | 1492 |
| 1488 void add(T data) { _sink.add(data); } | 1493 void add(T data) { _sink.add(data); } |
| 1489 void addError(error, [StackTrace stackTrace]) { | 1494 void addError(error, [StackTrace stackTrace]) { |
| 1490 _sink.addError(error, stackTrace); | 1495 _sink.addError(error, stackTrace); |
| 1491 } | 1496 } |
| 1492 void close() { _sink.close(); } | 1497 void close() { _sink.close(); } |
| 1493 } | 1498 } |
| OLD | NEW |