Index: sdk/lib/io/io_sink.dart |
diff --git a/sdk/lib/io/io_sink.dart b/sdk/lib/io/io_sink.dart |
index 71426da8f678ad427ff403e791961412241dfe97..a9ae101f6dc86cabf000d7008215c3b328bd59c2 100644 |
--- a/sdk/lib/io/io_sink.dart |
+++ b/sdk/lib/io/io_sink.dart |
@@ -37,6 +37,11 @@ abstract class IOSink<T> implements StreamConsumer<List<int>, T>, StringSink { |
Future<T> consume(Stream<List<int>> stream); |
/** |
+ * Provide functionality for piping to the [IOSink]. |
+ */ |
+ Future<T> addStream(Stream<List<int>> stream); |
+ |
+ /** |
* Like [consume], but will not close the target when done. |
*/ |
Future<T> writeStream(Stream<List<int>> stream); |
Søren Gjesse
2013/04/05 05:23:19
The plan is then to remove this in a future CL? We
floitsch
2013/04/05 16:21:32
Done.
|
@@ -44,7 +49,9 @@ abstract class IOSink<T> implements StreamConsumer<List<int>, T>, StringSink { |
/** |
* Close the target. |
*/ |
- void close(); |
+ // TODO(floitsch): Currently the future cannot be typed because it has |
+ // hardcoded type Future<HttpClientResponse> in subclass HttpClientRequest. |
+ Future close(); |
/** |
* Get future that will complete when all data has been written to |
@@ -134,17 +141,22 @@ class _IOSinkImpl<T> implements IOSink<T> { |
} |
Future<T> writeStream(Stream<List<int>> stream) { |
+ return addStream(stream); |
+ } |
+ |
+ Future<T> addStream(Stream<List<int>> stream) { |
if (_isBound) { |
throw new StateError("IOSink is already bound to a stream"); |
} |
return _fillFromStream(stream, unbind: true); |
} |
- void close() { |
+ Future close() { |
if (_isBound) { |
throw new StateError("IOSink is already bound to a stream"); |
} |
_controller.close(); |
+ return _pipeFuture; |
} |
Future<T> get done { |