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

Side by Side Diff: runtime/bin/file.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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/bin/file_impl.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 5
6 /** 6 /**
7 * FileMode describes the modes in which a file can be opened. 7 * FileMode describes the modes in which a file can be opened.
8 */ 8 */
9 class FileMode { 9 class FileMode {
10 static final READ = const FileMode(0); 10 static final READ = const FileMode(0);
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 * Files can be opened in three modes: 99 * Files can be opened in three modes:
100 * 100 *
101 * FileMode.READ: open the file for reading. If the file does not 101 * FileMode.READ: open the file for reading. If the file does not
102 * exist the [errorHandler] is called. 102 * exist the [errorHandler] is called.
103 * 103 *
104 * FileMode.WRITE: open the file for both reading and writing and 104 * FileMode.WRITE: open the file for both reading and writing and
105 * truncate the file to length zero. If the file does not exist the 105 * truncate the file to length zero. If the file does not exist the
106 * file is created. 106 * file is created.
107 * 107 *
108 * FileMode.APPEND: same as FileMode.WRITE except that the file is 108 * FileMode.APPEND: same as FileMode.WRITE except that the file is
109 * not truncated. 109 * not truncated and the position is set to the end of the file.
110 * 110 *
111 * By default mode is FileMode.READ. 111 * By default mode is FileMode.READ.
112 */ 112 */
113 RandomAccessFile openSync([FileMode mode]); 113 RandomAccessFile openSync([FileMode mode]);
114 114
115 /** 115 /**
116 * Get the canonical full path corresponding to the file name. The 116 * Get the canonical full path corresponding to the file name. The
117 * [fullPathHandler] is called with the result when the fullPath 117 * [fullPathHandler] is called with the result when the fullPath
118 * operation completes. 118 * operation completes.
119 */ 119 */
120 void fullPath(); 120 void fullPath();
121 121
122 /** 122 /**
123 * Synchronously get the canonical full path corresponding to the file name. 123 * Synchronously get the canonical full path corresponding to the file name.
124 */ 124 */
125 String fullPathSync(); 125 String fullPathSync();
126 126
127 /** 127 /**
128 * Create a new independent input stream for the file. The file 128 * Create a new independent input stream for the file. The file
129 * input stream must be closed when no longer used to free up 129 * input stream must be closed when no longer used to free up
130 * system resources. 130 * system resources.
131 */ 131 */
132 InputStream openInputStream(); 132 InputStream openInputStream();
133 133
134 /** 134 /**
135 * Creates a new independent output stream for the file. The file 135 * Creates a new independent output stream for the file. The file
136 * output stream must be closed when no longer used to free up 136 * output stream must be closed when no longer used to free up
137 * system resources. 137 * system resources.
138 *
139 * An output stream can be opened in two modes:
140 *
141 * FileMode.WRITE: create the stream and truncate the underlying
142 * file to length zero.
143 *
144 * FileMode.APPEND: create the stream and set the position to the end of
145 * the underlying file.
146 *
147 * By default the mode is FileMode.WRITE.
138 */ 148 */
139 OutputStream openOutputStream(); 149 OutputStream openOutputStream([FileMode mode]);
140 150
141 /** 151 /**
142 * Get the name of the file. 152 * Get the name of the file.
143 */ 153 */
144 String get name(); 154 String get name();
145 155
146 /** 156 /**
147 * Sets the handler that gets called when an [exists] operation 157 * Sets the handler that gets called when an [exists] operation
148 * completes. 158 * completes.
149 */ 159 */
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 */ 393 */
384 void set errorHandler(void handler(String error)); 394 void set errorHandler(void handler(String error));
385 } 395 }
386 396
387 397
388 class FileIOException implements Exception { 398 class FileIOException implements Exception {
389 const FileIOException([String this.message = ""]); 399 const FileIOException([String this.message = ""]);
390 String toString() => "FileIOException: $message"; 400 String toString() => "FileIOException: $message";
391 final String message; 401 final String message;
392 } 402 }
OLDNEW
« no previous file with comments | « no previous file | runtime/bin/file_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698