| Index: sdk/lib/io/io_sink.dart
|
| diff --git a/sdk/lib/io/io_sink.dart b/sdk/lib/io/io_sink.dart
|
| index 042a469fb67c770216b9d1c07def35d8e9e2e02d..45390d88375c6552ce068286a2ea0e0d5bd8e2c6 100644
|
| --- a/sdk/lib/io/io_sink.dart
|
| +++ b/sdk/lib/io/io_sink.dart
|
| @@ -46,6 +46,17 @@ abstract class IOSink implements StreamSink<List<int>>, StringSink {
|
| Future addStream(Stream<List<int>> stream);
|
|
|
| /**
|
| + * Returns a [Future] that completes once all buffered data is accepted by the
|
| + * to underlying [StreamConsumer].
|
| + *
|
| + * It's an error to call this method, while an [addStream] is incomplete.
|
| + *
|
| + * NOTE: This is not necessarily the same as the data being flushed by the
|
| + * operating system.
|
| + */
|
| + Future flush();
|
| +
|
| + /**
|
| * Close the target.
|
| */
|
| Future close();
|
| @@ -99,6 +110,13 @@ class _StreamSinkImpl<T> implements StreamSink<T> {
|
| return future.then((_) => targetAddStream());
|
| }
|
|
|
| + Future flush() {
|
| + // Adding an empty stream-controller will return a future that will complete
|
| + // when all data is done.
|
| + var controller = new StreamController()..close();
|
| + return addStream(controller.stream).then((_) => this);
|
| + }
|
| +
|
| Future close() {
|
| if (_isBound) {
|
| throw new StateError("StreamSink is bound to a stream");
|
|
|