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

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

Issue 1193653002: Add file modes for opening a file write only (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Addressed review comments + fixed analyzer reported issues Created 5 years, 6 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 | « runtime/bin/file_win.cc ('k') | 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 879915825fa507d261a10656f3b34eb4de933694..691d7837445fff4f286dbe4460652e430887b4ef 100644
--- a/sdk/lib/io/file.dart
+++ b/sdk/lib/io/file.dart
@@ -10,13 +10,20 @@ part of dart.io;
class FileMode {
/// The mode for opening a file only for reading.
static const READ = const FileMode._internal(0);
- /// The mode for opening a file for reading and writing. The file is
+ /// Mode for opening a file for reading and writing. The file is
/// overwritten if it already exists. The file is created if it does not
/// already exist.
static const WRITE = const FileMode._internal(1);
- /// The mode for opening a file for reading and writing to the
+ /// Mode for opening a file for reading and writing to the
/// end of it. The file is created if it does not already exist.
static const APPEND = const FileMode._internal(2);
+ /// Mode for opening a file for writing *only*. The file is
+ /// overwritten if it already exists. The file is created if it does not
+ /// already exist.
+ static const WRITE_ONLY = const FileMode._internal(3);
+ /// Mode for opening a file for writing *only* to the
+ /// end of it. The file is created if it does not already exist.
+ static const WRITE_ONLY_APPEND = const FileMode._internal(4);
final int _mode;
const FileMode._internal(this._mode);
@@ -31,6 +38,13 @@ const WRITE = FileMode.WRITE;
/// The mode for opening a file for reading and writing to the
/// end of it. The file is created if it does not already exist.
const APPEND = FileMode.APPEND;
+/// Mode for opening a file for writing *only*. The file is
+/// overwritten if it already exists. The file is created if it does not
+/// already exist.
+const WRITE_ONLY = FileMode.WRITE_ONLY;
+/// Mode for opening a file for writing *only* to the
+/// end of it. The file is created if it does not already exist.
+const WRITE_ONLY_APPEND = FileMode.WRITE_ONLY_APPEND;
/// Type of lock when requesting a lock on a file.
« no previous file with comments | « runtime/bin/file_win.cc ('k') | sdk/lib/io/file_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698