| 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 1655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1666 /** | 1666 /** |
| 1667 * An [Iterator] like interface for the values of a [Stream]. | 1667 * An [Iterator] like interface for the values of a [Stream]. |
| 1668 * | 1668 * |
| 1669 * This wraps a [Stream] and a subscription on the stream. It listens | 1669 * This wraps a [Stream] and a subscription on the stream. It listens |
| 1670 * on the stream, and completes the future returned by [moveNext] when the | 1670 * on the stream, and completes the future returned by [moveNext] when the |
| 1671 * next value becomes available. | 1671 * next value becomes available. |
| 1672 */ | 1672 */ |
| 1673 abstract class StreamIterator<T> { | 1673 abstract class StreamIterator<T> { |
| 1674 | 1674 |
| 1675 /** Create a [StreamIterator] on [stream]. */ | 1675 /** Create a [StreamIterator] on [stream]. */ |
| 1676 factory StreamIterator(Stream<T> stream) = _StreamIteratorImpl<T>; | 1676 factory StreamIterator(Stream<T> stream) |
| 1677 // TODO(lrn): use redirecting factory constructor when type |
| 1678 // arguments are supported. |
| 1679 => new _StreamIteratorImpl<T>(stream); |
| 1677 | 1680 |
| 1678 /** | 1681 /** |
| 1679 * Wait for the next stream value to be available. | 1682 * Wait for the next stream value to be available. |
| 1680 * | 1683 * |
| 1681 * Returns a future which will complete with either `true` or `false`. | 1684 * Returns a future which will complete with either `true` or `false`. |
| 1682 * Completing with `true` means that another event has been received and | 1685 * Completing with `true` means that another event has been received and |
| 1683 * can be read as [current]. | 1686 * can be read as [current]. |
| 1684 * Completing with `false` means that the stream itearation is done and | 1687 * Completing with `false` means that the stream itearation is done and |
| 1685 * no further events will ever be available. | 1688 * no further events will ever be available. |
| 1686 * The future may complete with an error, if the stream produces an error, | 1689 * The future may complete with an error, if the stream produces an error, |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1732 class _ControllerEventSinkWrapper<T> implements EventSink<T> { | 1735 class _ControllerEventSinkWrapper<T> implements EventSink<T> { |
| 1733 EventSink _sink; | 1736 EventSink _sink; |
| 1734 _ControllerEventSinkWrapper(this._sink); | 1737 _ControllerEventSinkWrapper(this._sink); |
| 1735 | 1738 |
| 1736 void add(T data) { _sink.add(data); } | 1739 void add(T data) { _sink.add(data); } |
| 1737 void addError(error, [StackTrace stackTrace]) { | 1740 void addError(error, [StackTrace stackTrace]) { |
| 1738 _sink.addError(error, stackTrace); | 1741 _sink.addError(error, stackTrace); |
| 1739 } | 1742 } |
| 1740 void close() { _sink.close(); } | 1743 void close() { _sink.close(); } |
| 1741 } | 1744 } |
| OLD | NEW |