| 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 907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 918 | 918 |
| 919 StreamSubscription<T> listen(void onData(T value), | 919 StreamSubscription<T> listen(void onData(T value), |
| 920 { void onError(error), | 920 { void onError(error), |
| 921 void onDone(), | 921 void onDone(), |
| 922 bool cancelOnError }) { | 922 bool cancelOnError }) { |
| 923 return _stream.listen(onData, onError: onError, onDone: onDone, | 923 return _stream.listen(onData, onError: onError, onDone: onDone, |
| 924 cancelOnError: cancelOnError); | 924 cancelOnError: cancelOnError); |
| 925 } | 925 } |
| 926 } | 926 } |
| 927 | 927 |
| 928 /** | |
| 929 * [EventSink] wrapper that only exposes the [EventSink] interface. | |
| 930 */ | |
| 931 class _EventSinkView<T> extends EventSink<T> { | |
| 932 final EventSink<T> _sink; | |
| 933 | |
| 934 _EventSinkView(this._sink); | |
| 935 | |
| 936 void add(T value) { _sink.add(value); } | |
| 937 void addError(error) { _sink.addError(error); } | |
| 938 void close() { _sink.close(); } | |
| 939 } | |
| 940 | |
| 941 | 928 |
| 942 /** | 929 /** |
| 943 * The target of a [Stream.pipe] call. | 930 * The target of a [Stream.pipe] call. |
| 944 * | 931 * |
| 945 * The [Stream.pipe] call will pass itself to this object, and then return | 932 * The [Stream.pipe] call will pass itself to this object, and then return |
| 946 * the resulting [Future]. The pipe should complete the future when it's | 933 * the resulting [Future]. The pipe should complete the future when it's |
| 947 * done. | 934 * done. |
| 948 */ | 935 */ |
| 949 abstract class StreamConsumer<S> { | 936 abstract class StreamConsumer<S> { |
| 950 Future addStream(Stream<S> stream); | 937 Future addStream(Stream<S> stream); |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1246 * | 1233 * |
| 1247 * If a [moveNext] call has been made, it will complete with `false` as value, | 1234 * If a [moveNext] call has been made, it will complete with `false` as value, |
| 1248 * as will all further calls to [moveNext]. | 1235 * as will all further calls to [moveNext]. |
| 1249 * | 1236 * |
| 1250 * If you need to stop listening for values before the stream iterator is | 1237 * If you need to stop listening for values before the stream iterator is |
| 1251 * automatically closed, you must call [cancel] to ensure that the stream | 1238 * automatically closed, you must call [cancel] to ensure that the stream |
| 1252 * is properly closed. | 1239 * is properly closed. |
| 1253 */ | 1240 */ |
| 1254 void cancel(); | 1241 void cancel(); |
| 1255 } | 1242 } |
| OLD | NEW |