Index: sdk/lib/core/sink.dart |
diff --git a/sdk/lib/core/sink.dart b/sdk/lib/core/sink.dart |
new file mode 100644 |
index 0000000000000000000000000000000000000000..51120c3678102a9693537649309ed948669adcdd |
--- /dev/null |
+++ b/sdk/lib/core/sink.dart |
@@ -0,0 +1,30 @@ |
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
+// for details. All rights reserved. Use of this source code is governed by a |
+// BSD-style license that can be found in the LICENSE file. |
+ |
+part of dart.core; |
+ |
+/** |
+ * A generic destination for data. |
Anders Johnsen
2014/03/19 13:12:01
data or events?
Lasse Reichstein Nielsen
2014/03/19 15:25:27
Data. It's as generic as it can get. "Event" means
|
+ * |
+ * Multiple data values can be put into a sink, and when no more data are |
Anders Johnsen
2014/03/19 13:12:01
no more data is ?
Lasse Reichstein Nielsen
2014/03/19 15:25:27
Can be either. Singular is probably more common, s
|
+ * available, the sink should be closed. |
+ * |
+ * This is a generic interface that other data receivers can implement. |
+ */ |
+abstract class Sink<T> { |
+ /** |
+ * Put the data into the sink. |
+ * |
+ * Must not be called after a call to [close]. |
+ */ |
+ void add(T data); |
Anders Johnsen
2014/03/19 13:12:01
Add space after.
Lasse Reichstein Nielsen
2014/03/19 15:25:27
Done.
|
+ /** |
+ * Tell the sink that no further data will be added. |
+ * |
+ * Calling this method more than once is allowed, but does nothing. |
+ * |
+ * The [add] method must not be called after this method. |
+ */ |
+ void close(); |
+} |