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

Unified Diff: sdk/lib/io/file.dart

Issue 20745006: Add a flush operations to IOSink (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix merge issue Created 7 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | sdk/lib/io/file_impl.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/io/file.dart
diff --git a/sdk/lib/io/file.dart b/sdk/lib/io/file.dart
index 1c0e37142e8899b19ff2a8a1bcb70a2425a76044..3064cc3e2b584082d32451e50150b33f0147c6d7 100644
--- a/sdk/lib/io/file.dart
+++ b/sdk/lib/io/file.dart
@@ -249,8 +249,13 @@ abstract class File implements FileSystemEntity {
* By default [writeAsBytes] creates the file for writing and truncates the
* file if it already exists. In order to append the bytes to an existing
* file, pass [FileMode.APPEND] as the optional mode parameter.
+ *
+ * If the argument [flush] is set to `true`, the data written will be
+ * flushed to the file system before the returned future completes.
*/
- Future<File> writeAsBytes(List<int> bytes, {FileMode mode: FileMode.WRITE});
+ Future<File> writeAsBytes(List<int> bytes,
+ {FileMode mode: FileMode.WRITE,
+ bool flush: false});
/**
* Synchronously write a list of bytes to a file.
@@ -261,9 +266,14 @@ abstract class File implements FileSystemEntity {
* the file if it already exists. In order to append the bytes to an existing
* file, pass [FileMode.APPEND] as the optional mode parameter.
*
+ * If the [flush] argument is set to `true` data written will be
+ * flushed to the file system before returning.
+ *
* Throws a [FileSystemException] if the operation fails.
*/
- void writeAsBytesSync(List<int> bytes, {FileMode mode: FileMode.WRITE});
+ void writeAsBytesSync(List<int> bytes,
+ {FileMode mode: FileMode.WRITE,
+ bool flush: false});
/**
* Write a string to a file.
@@ -275,10 +285,15 @@ abstract class File implements FileSystemEntity {
* By default [writeAsString] creates the file for writing and truncates the
* file if it already exists. In order to append the bytes to an existing
* file, pass [FileMode.APPEND] as the optional mode parameter.
+ *
+ * If the argument [flush] is set to `true`, the data written will be
+ * flushed to the file system before the returned future completes.
+ *
*/
Future<File> writeAsString(String contents,
{FileMode mode: FileMode.WRITE,
- Encoding encoding: UTF8});
+ Encoding encoding: UTF8,
+ bool flush: false});
/**
* Synchronously write a string to a file.
@@ -291,11 +306,15 @@ abstract class File implements FileSystemEntity {
* to an existing file, pass [FileMode.APPEND] as the optional mode
* parameter.
*
+ * If the [flush] argument is set to `true` data written will be
+ * flushed to the file system before returning.
+ *
* Throws a [FileSystemException] if the operation fails.
*/
void writeAsStringSync(String contents,
{FileMode mode: FileMode.WRITE,
- Encoding encoding: UTF8});
+ Encoding encoding: UTF8,
+ bool flush: false});
/**
* Get the path of the file.
« no previous file with comments | « no previous file | sdk/lib/io/file_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698