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

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: Created 7 years, 5 months 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') | sdk/lib/io/io_sink.dart » ('J')
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 dba693195e89c292f2c1b8bdc349c6ec3fe713fe..34bdb76bbd9f2f61e832a28c3062f4b2dbaf483d 100644
--- a/sdk/lib/io/file.dart
+++ b/sdk/lib/io/file.dart
@@ -270,8 +270,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.
@@ -282,9 +287,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 the returning.
+ *
* Throws a [FileException] 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.
@@ -296,10 +306,14 @@ 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: Encoding.UTF_8});
+ Encoding encoding: Encoding.UTF_8,
+ bool flush: false});
/**
* Synchronously write a string to a file.
@@ -312,11 +326,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 the returning.
+ *
* Throws a [FileException] if the operation fails.
*/
void writeAsStringSync(String contents,
{FileMode mode: FileMode.WRITE,
- Encoding encoding: Encoding.UTF_8});
+ Encoding encoding: Encoding.UTF_8,
+ bool flush: false});
/**
* Get the path of the file.
« no previous file with comments | « no previous file | sdk/lib/io/file_impl.dart » ('j') | sdk/lib/io/io_sink.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698