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 1218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1229 * In case of a `done` event the future completes with the given | 1229 * In case of a `done` event the future completes with the given |
1230 * [futureValue]. | 1230 * [futureValue]. |
1231 */ | 1231 */ |
1232 Future asFuture([var futureValue]); | 1232 Future asFuture([var futureValue]); |
1233 } | 1233 } |
1234 | 1234 |
1235 | 1235 |
1236 /** | 1236 /** |
1237 * An interface that abstracts creation or handling of [Stream] events. | 1237 * An interface that abstracts creation or handling of [Stream] events. |
1238 */ | 1238 */ |
1239 abstract class EventSink<T> { | 1239 abstract class EventSink<T> implements Sink<T> { |
1240 /** Create a data event */ | 1240 /** Create a data event */ |
1241 void add(T event); | 1241 void add(T event); |
1242 /** Create an async error. */ | 1242 /** Create an async error. */ |
1243 void addError(errorEvent, [StackTrace stackTrace]); | 1243 void addError(errorEvent, [StackTrace stackTrace]); |
1244 /** Request a stream to close. */ | 1244 /** Request a stream to close. */ |
1245 void close(); | 1245 void close(); |
1246 } | 1246 } |
1247 | 1247 |
1248 | 1248 |
1249 /** [Stream] wrapper that only exposes the [Stream] interface. */ | 1249 /** [Stream] wrapper that only exposes the [Stream] interface. */ |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1482 class _ControllerEventSinkWrapper<T> implements EventSink<T> { | 1482 class _ControllerEventSinkWrapper<T> implements EventSink<T> { |
1483 EventSink _sink; | 1483 EventSink _sink; |
1484 _ControllerEventSinkWrapper(this._sink); | 1484 _ControllerEventSinkWrapper(this._sink); |
1485 | 1485 |
1486 void add(T data) { _sink.add(data); } | 1486 void add(T data) { _sink.add(data); } |
1487 void addError(error, [StackTrace stackTrace]) { | 1487 void addError(error, [StackTrace stackTrace]) { |
1488 _sink.addError(error, stackTrace); | 1488 _sink.addError(error, stackTrace); |
1489 } | 1489 } |
1490 void close() { _sink.close(); } | 1490 void close() { _sink.close(); } |
1491 } | 1491 } |
OLD | NEW |