| 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 |
| 928 | 941 |
| 929 /** | 942 /** |
| 930 * The target of a [Stream.pipe] call. | 943 * The target of a [Stream.pipe] call. |
| 931 * | 944 * |
| 932 * The [Stream.pipe] call will pass itself to this object, and then return | 945 * The [Stream.pipe] call will pass itself to this object, and then return |
| 933 * the resulting [Future]. The pipe should complete the future when it's | 946 * the resulting [Future]. The pipe should complete the future when it's |
| 934 * done. | 947 * done. |
| 935 */ | 948 */ |
| 936 abstract class StreamConsumer<S> { | 949 abstract class StreamConsumer<S> { |
| 937 Future addStream(Stream<S> stream); | 950 Future addStream(Stream<S> stream); |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1233 * | 1246 * |
| 1234 * If a [moveNext] call has been made, it will complete with `false` as value, | 1247 * If a [moveNext] call has been made, it will complete with `false` as value, |
| 1235 * as will all further calls to [moveNext]. | 1248 * as will all further calls to [moveNext]. |
| 1236 * | 1249 * |
| 1237 * If you need to stop listening for values before the stream iterator is | 1250 * If you need to stop listening for values before the stream iterator is |
| 1238 * automatically closed, you must call [cancel] to ensure that the stream | 1251 * automatically closed, you must call [cancel] to ensure that the stream |
| 1239 * is properly closed. | 1252 * is properly closed. |
| 1240 */ | 1253 */ |
| 1241 void cancel(); | 1254 void cancel(); |
| 1242 } | 1255 } |
| OLD | NEW |