Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(651)

Side by Side Diff: sdk/lib/async/stream.dart

Issue 203603008: Introduce class Sink<T>. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/analysis_server/lib/src/channel.dart ('k') | sdk/lib/convert/ascii.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1218 matching lines...) Expand 10 before | Expand all | Expand 10 after
1229 * In case of a `done` event the future completes with the given 1229 * In case of a `done` event the future completes with the given
1230 * [futureValue]. 1230 * [futureValue].
1231 */ 1231 */
1232 Future asFuture([var futureValue]); 1232 Future asFuture([var futureValue]);
1233 } 1233 }
1234 1234
1235 1235
1236 /** 1236 /**
1237 * An interface that abstracts creation or handling of [Stream] events. 1237 * An interface that abstracts creation or handling of [Stream] events.
1238 */ 1238 */
1239 abstract class EventSink<T> { 1239 abstract class EventSink<T> implements Sink<T> {
1240 /** Create a data event */ 1240 /** Create a data event */
1241 void add(T event); 1241 void add(T event);
1242 /** Create an async error. */ 1242 /** Create an async error. */
1243 void addError(errorEvent, [StackTrace stackTrace]); 1243 void addError(errorEvent, [StackTrace stackTrace]);
1244 /** Request a stream to close. */ 1244 /** Request a stream to close. */
1245 void close(); 1245 void close();
1246 } 1246 }
1247 1247
1248 1248
1249 /** [Stream] wrapper that only exposes the [Stream] interface. */ 1249 /** [Stream] wrapper that only exposes the [Stream] interface. */
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
1482 class _ControllerEventSinkWrapper<T> implements EventSink<T> { 1482 class _ControllerEventSinkWrapper<T> implements EventSink<T> {
1483 EventSink _sink; 1483 EventSink _sink;
1484 _ControllerEventSinkWrapper(this._sink); 1484 _ControllerEventSinkWrapper(this._sink);
1485 1485
1486 void add(T data) { _sink.add(data); } 1486 void add(T data) { _sink.add(data); }
1487 void addError(error, [StackTrace stackTrace]) { 1487 void addError(error, [StackTrace stackTrace]) {
1488 _sink.addError(error, stackTrace); 1488 _sink.addError(error, stackTrace);
1489 } 1489 }
1490 void close() { _sink.close(); } 1490 void close() { _sink.close(); }
1491 } 1491 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/channel.dart ('k') | sdk/lib/convert/ascii.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698