Chromium Code Reviews| Index: sdk/lib/io/io_sink.dart |
| diff --git a/sdk/lib/io/io_sink.dart b/sdk/lib/io/io_sink.dart |
| index b954a86d5ffeed71ac9f0e15677613193ed04251..f2685a3ec2181c9c9e53190940fc80f12c5692ed 100644 |
| --- a/sdk/lib/io/io_sink.dart |
| +++ b/sdk/lib/io/io_sink.dart |
| @@ -46,6 +46,25 @@ abstract class IOSink implements StreamSink<List<int>>, StringSink { |
| Future addStream(Stream<List<int>> stream); |
| /** |
| + * Flushes the data currently added to the stream to underlying |
| + * storage if possible. |
| + * |
| + * Returns a future which completes when the flush operation is |
| + * complete. |
| + * |
| + * Currently this method only has effect if the target of the |
| + * [IOSink] is a file. For all other targets this does nothing |
| + * and the returned future completed immediately. |
| + * |
| + * If [add] is used to write to the [IOSink] all data written using |
| + * [add] before calling [flush] will be flushed. If [addStream] is |
| + * used and [flush] is called before the future returned from |
| + * [addStream] is complete the abount of data which will be flushed |
| + * is undefined. |
| + */ |
| + Future flush(); |
| + |
| + /** |
| * Close the target. |
| */ |
| Future close(); |
| @@ -231,4 +250,12 @@ class _IOSinkImpl extends _StreamSinkImpl<List<int>> implements IOSink { |
| void writeCharCode(int charCode) { |
| write(new String.fromCharCode(charCode)); |
| } |
| + |
| + Future flush() { |
|
Anders Johnsen
2013/08/01 13:54:28
So, several comments and concerns about this appro
Søren Gjesse
2013/08/01 14:29:18
As the comment above states this only does anythin
|
| + if (_target is _FileStreamConsumer) { |
| + return _target.flush(); |
| + } else { |
| + return new Future.value(null); |
| + } |
| + } |
| } |