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 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
553 */ | 553 */ |
554 Stream<T> handleError(Function onError, {bool test(error)}) { | 554 Stream<T> handleError(Function onError, {bool test(error)}) { |
555 return new _HandleErrorStream<T>(this, onError, test); | 555 return new _HandleErrorStream<T>(this, onError, test); |
556 } | 556 } |
557 | 557 |
558 /** | 558 /** |
559 * Transforms each element of this stream into a sequence of elements. | 559 * Transforms each element of this stream into a sequence of elements. |
560 * | 560 * |
561 * Returns a new stream where each element of this stream is replaced | 561 * Returns a new stream where each element of this stream is replaced |
562 * by zero or more data events. | 562 * by zero or more data events. |
563 * The event values are proveded as an [Iterable] by a call to [convert] | 563 * The event values are provided as an [Iterable] by a call to [convert] |
564 * with the element as argument, and the elements of that iterable is | 564 * with the element as argument, and the elements of that iterable is |
565 * emitted in iteration order. | 565 * emitted in iteration order. |
566 * If calling [convert] throws, or if iteration of the returned values throws, | 566 * If calling [convert] throws, or if the iteration of the returned values |
567 * the error is emitted on the returned stream and iteration ends for that | 567 * throws, the error is emitted on the returned stream and iteration ends |
568 * element of this stream. | 568 * for that element of this stream. |
569 * | 569 * |
570 * Error events and the done event of this stream are forwarded directly | 570 * Error events and the done event of this stream are forwarded directly |
571 * to the returned stream. | 571 * to the returned stream. |
572 * | 572 * |
573 * The returned stream is a broadcast stream if this stream is. | 573 * The returned stream is a broadcast stream if this stream is. |
574 * If a broadcast stream is listened to more than once, each subscription | 574 * If a broadcast stream is listened to more than once, each subscription |
575 * will individually call `convert` and expand the events. | 575 * will individually call `convert` and expand the events. |
576 */ | 576 */ |
577 Stream<S> expand<S>(Iterable<S> convert(T element)) { | 577 Stream<S> expand<S>(Iterable<S> convert(T element)) { |
578 return new _ExpandStream<T, S>(this, convert); | 578 return new _ExpandStream<T, S>(this, convert); |
(...skipping 1411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1990 } | 1990 } |
1991 | 1991 |
1992 void addError(error, [StackTrace stackTrace]) { | 1992 void addError(error, [StackTrace stackTrace]) { |
1993 _sink.addError(error, stackTrace); | 1993 _sink.addError(error, stackTrace); |
1994 } | 1994 } |
1995 | 1995 |
1996 void close() { | 1996 void close() { |
1997 _sink.close(); | 1997 _sink.close(); |
1998 } | 1998 } |
1999 } | 1999 } |
OLD | NEW |