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