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

Unified Diff: runtime/bin/file_impl.dart

Issue 9346015: Change file opening operation to set position at the end of the file when FileMode.APPEND is used. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 8 years, 10 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.dart ('k') | runtime/bin/file_linux.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/file_impl.dart
===================================================================
--- runtime/bin/file_impl.dart (revision 3943)
+++ runtime/bin/file_impl.dart (working copy)
@@ -49,8 +49,8 @@
class _FileOutputStream implements OutputStream {
- _FileOutputStream(File file) {
- _file = file.openSync(FileMode.WRITE);
+ _FileOutputStream(File file, FileMode mode) {
+ _file = file.openSync(mode);
}
bool write(List<int> buffer, [bool copyBuffer = false]) {
@@ -647,7 +647,14 @@
InputStream openInputStream() => new _FileInputStream(this);
- OutputStream openOutputStream() => new _FileOutputStream(this);
+ OutputStream openOutputStream([FileMode mode = FileMode.WRITE]) {
+ if (mode != FileMode.WRITE &&
+ mode != FileMode.APPEND) {
+ throw new FileIOException(
+ "Wrong FileMode. Use FileMode.WRITE or FileMode.APPEND");
+ }
+ return new _FileOutputStream(this, mode);
+ }
String get name() => _name;
« no previous file with comments | « runtime/bin/file.dart ('k') | runtime/bin/file_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698