| 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 1364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1375 | 1375 |
| 1376 | 1376 |
| 1377 /** | 1377 /** |
| 1378 * An interface that abstracts creation or handling of [Stream] events. | 1378 * An interface that abstracts creation or handling of [Stream] events. |
| 1379 */ | 1379 */ |
| 1380 abstract class EventSink<T> implements Sink<T> { | 1380 abstract class EventSink<T> implements Sink<T> { |
| 1381 /** Send a data event to a stream. */ | 1381 /** Send a data event to a stream. */ |
| 1382 void add(T event); | 1382 void add(T event); |
| 1383 /** Send an async error to a stream. */ | 1383 /** Send an async error to a stream. */ |
| 1384 void addError(errorEvent, [StackTrace stackTrace]); | 1384 void addError(errorEvent, [StackTrace stackTrace]); |
| 1385 /** Send a done event to a stream.*/ | 1385 /** Send a done event to a stream. */ |
| 1386 void close(); | 1386 void close(); |
| 1387 } | 1387 } |
| 1388 | 1388 |
| 1389 | 1389 |
| 1390 /** [Stream] wrapper that only exposes the [Stream] interface. */ | 1390 /** [Stream] wrapper that only exposes the [Stream] interface. */ |
| 1391 class StreamView<T> extends Stream<T> { | 1391 class StreamView<T> extends Stream<T> { |
| 1392 Stream<T> _stream; | 1392 Stream<T> _stream; |
| 1393 | 1393 |
| 1394 StreamView(this._stream); | 1394 StreamView(this._stream); |
| 1395 | 1395 |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1636 class _ControllerEventSinkWrapper<T> implements EventSink<T> { | 1636 class _ControllerEventSinkWrapper<T> implements EventSink<T> { |
| 1637 EventSink _sink; | 1637 EventSink _sink; |
| 1638 _ControllerEventSinkWrapper(this._sink); | 1638 _ControllerEventSinkWrapper(this._sink); |
| 1639 | 1639 |
| 1640 void add(T data) { _sink.add(data); } | 1640 void add(T data) { _sink.add(data); } |
| 1641 void addError(error, [StackTrace stackTrace]) { | 1641 void addError(error, [StackTrace stackTrace]) { |
| 1642 _sink.addError(error, stackTrace); | 1642 _sink.addError(error, stackTrace); |
| 1643 } | 1643 } |
| 1644 void close() { _sink.close(); } | 1644 void close() { _sink.close(); } |
| 1645 } | 1645 } |
| OLD | NEW |