| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 14 matching lines...) Expand all Loading... |
| 25 } | 25 } |
| 26 | 26 |
| 27 /** | 27 /** |
| 28 * Creates a single-subscription stream that gets its data from [data]. | 28 * Creates a single-subscription stream that gets its data from [data]. |
| 29 */ | 29 */ |
| 30 factory Stream.fromIterable(Iterable<T> data) { | 30 factory Stream.fromIterable(Iterable<T> data) { |
| 31 return new _IterableSingleStreamImpl<T>(data); | 31 return new _IterableSingleStreamImpl<T>(data); |
| 32 } | 32 } |
| 33 | 33 |
| 34 /** | 34 /** |
| 35 * Returns a multi-subscription stream that produces the same events as this. |
| 36 * |
| 37 * If this stream is single-subscription, return a new stream that allows |
| 38 * multiple subscribers. It will subscribe to this stream when its first |
| 39 * subscriber is added, and unsubscribe again when the last subscription is |
| 40 * cancelled. |
| 41 * |
| 42 * If this stream is already multi-subscriber, it is returned unmodified. |
| 43 */ |
| 44 Stream<T> asMultiSubscriberStream(); |
| 45 |
| 46 /** |
| 35 * Stream that outputs events from the [sources] in cyclic order. | 47 * Stream that outputs events from the [sources] in cyclic order. |
| 36 * | 48 * |
| 37 * The merged streams are paused and resumed in order to ensure the proper | 49 * The merged streams are paused and resumed in order to ensure the proper |
| 38 * order of output events. | 50 * order of output events. |
| 39 */ | 51 */ |
| 40 factory Stream.cyclic(Iterable<Stream> sources) { | 52 factory Stream.cyclic(Iterable<Stream> sources) { |
| 41 return new CyclicScheduleStream<T>(sources); | 53 return new CyclicScheduleStream<T>(sources); |
| 42 } | 54 } |
| 43 | 55 |
| 44 /** | 56 /** |
| (...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 840 sink.signalError(error); | 852 sink.signalError(error); |
| 841 } | 853 } |
| 842 | 854 |
| 843 /** | 855 /** |
| 844 * Handle an incoming done event. | 856 * Handle an incoming done event. |
| 845 */ | 857 */ |
| 846 void handleDone(StreamSink<T> sink) { | 858 void handleDone(StreamSink<T> sink) { |
| 847 sink.close(); | 859 sink.close(); |
| 848 } | 860 } |
| 849 } | 861 } |
| OLD | NEW |