| 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 824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 835 * | 835 * |
| 836 * Internally the method cancels its subscription after these elements. This | 836 * Internally the method cancels its subscription after these elements. This |
| 837 * means that single-subscription (non-broadcast) streams are closed and | 837 * means that single-subscription (non-broadcast) streams are closed and |
| 838 * cannot be reused after a call to this method. | 838 * cannot be reused after a call to this method. |
| 839 * | 839 * |
| 840 * The returned stream is a broadcast stream if this stream is. | 840 * The returned stream is a broadcast stream if this stream is. |
| 841 * For a broadcast stream, the events are only counted from the time | 841 * For a broadcast stream, the events are only counted from the time |
| 842 * the returned stream is listened to. | 842 * the returned stream is listened to. |
| 843 */ | 843 */ |
| 844 Stream<T> take(int count) { | 844 Stream<T> take(int count) { |
| 845 return new _TakeStream(this, count); | 845 return new _TakeStream<T>(this, count); |
| 846 } | 846 } |
| 847 | 847 |
| 848 /** | 848 /** |
| 849 * Forwards data events while [test] is successful. | 849 * Forwards data events while [test] is successful. |
| 850 * | 850 * |
| 851 * The returned stream provides the same events as this stream as long | 851 * The returned stream provides the same events as this stream as long |
| 852 * as [test] returns [:true:] for the event data. The stream is done | 852 * as [test] returns [:true:] for the event data. The stream is done |
| 853 * when either this stream is done, or when this stream first provides | 853 * when either this stream is done, or when this stream first provides |
| 854 * a value that [test] doesn't accept. | 854 * a value that [test] doesn't accept. |
| 855 * | 855 * |
| (...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1735 class _ControllerEventSinkWrapper<T> implements EventSink<T> { | 1735 class _ControllerEventSinkWrapper<T> implements EventSink<T> { |
| 1736 EventSink _sink; | 1736 EventSink _sink; |
| 1737 _ControllerEventSinkWrapper(this._sink); | 1737 _ControllerEventSinkWrapper(this._sink); |
| 1738 | 1738 |
| 1739 void add(T data) { _sink.add(data); } | 1739 void add(T data) { _sink.add(data); } |
| 1740 void addError(error, [StackTrace stackTrace]) { | 1740 void addError(error, [StackTrace stackTrace]) { |
| 1741 _sink.addError(error, stackTrace); | 1741 _sink.addError(error, stackTrace); |
| 1742 } | 1742 } |
| 1743 void close() { _sink.close(); } | 1743 void close() { _sink.close(); } |
| 1744 } | 1744 } |
| OLD | NEW |