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

Side by Side Diff: sdk/lib/io/file.dart

Issue 11663004: Fix File.writeAsString to use named optional arguments. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years 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 | sdk/lib/io/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 part of dart.io; 5 part of dart.io;
6 6
7 /** 7 /**
8 * FileMode describes the modes in which a file can be opened. 8 * FileMode describes the modes in which a file can be opened.
9 */ 9 */
10 class FileMode { 10 class FileMode {
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 * 243 *
244 * Opens the file, writes the string in the given encoding, and closes the 244 * Opens the file, writes the string in the given encoding, and closes the
245 * file. Returns a [:Future<File>:] that completes with this [File] object 245 * file. Returns a [:Future<File>:] that completes with this [File] object
246 * once the entire operation has completed. 246 * once the entire operation has completed.
247 * 247 *
248 * By default [writeAsString] creates the file for writing and truncates the 248 * By default [writeAsString] creates the file for writing and truncates the
249 * file if it already exists. In order to append the bytes to an existing 249 * file if it already exists. In order to append the bytes to an existing
250 * file pass [:FileMode.APPEND:] as the optional mode parameter. 250 * file pass [:FileMode.APPEND:] as the optional mode parameter.
251 */ 251 */
252 Future<File> writeAsString(String contents, 252 Future<File> writeAsString(String contents,
253 [Encoding encoding = Encoding.UTF_8, 253 {FileMode mode: FileMode.WRITE,
254 FileMode mode = FileMode.WRITE]); 254 Encoding encoding: Encoding.UTF_8});
255 255
256 /** 256 /**
257 * Synchronously write a string to a file. 257 * Synchronously write a string to a file.
258 * 258 *
259 * Opens the file, writes the string in the given encoding, and closes the 259 * Opens the file, writes the string in the given encoding, and closes the
260 * file. 260 * file.
261 * 261 *
262 * By default [writeAsStringSync] creates the file for writing and 262 * By default [writeAsStringSync] creates the file for writing and
263 * truncates the file if it already exists. In order to append the bytes 263 * truncates the file if it already exists. In order to append the bytes
264 * to an existing file pass [:FileMode.APPEND:] as the optional mode 264 * to an existing file pass [:FileMode.APPEND:] as the optional mode
265 * parameter. 265 * parameter.
266 */ 266 */
267 void writeAsStringSync(String contents, 267 void writeAsStringSync(String contents,
268 [Encoding encoding = Encoding.UTF_8, 268 {FileMode mode: FileMode.WRITE,
269 FileMode mode = FileMode.WRITE]); 269 Encoding encoding: Encoding.UTF_8});
270 270
271 /** 271 /**
272 * Get the name of the file. 272 * Get the name of the file.
273 */ 273 */
274 String get name; 274 String get name;
275 } 275 }
276 276
277 277
278 /** 278 /**
279 * [RandomAccessFile] provides random access to the data in a 279 * [RandomAccessFile] provides random access to the data in a
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 sb.add(" ($osError)"); 446 sb.add(" ($osError)");
447 } 447 }
448 } else if (osError != null) { 448 } else if (osError != null) {
449 sb.add(": osError"); 449 sb.add(": osError");
450 } 450 }
451 return sb.toString(); 451 return sb.toString();
452 } 452 }
453 final String message; 453 final String message;
454 final OSError osError; 454 final OSError osError;
455 } 455 }
OLDNEW
« 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