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

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

Issue 12504006: Make IOSink implement StringSink (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixed accidental edit Created 7 years, 9 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
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 {
11 static const READ = const FileMode._internal(0); 11 static const READ = const FileMode._internal(0);
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 /** 167 /**
168 * Creates a new independent [IOSink] for the file. The 168 * Creates a new independent [IOSink] for the file. The
169 * [IOSink] must be closed when no longer used, to free 169 * [IOSink] must be closed when no longer used, to free
170 * system resources. 170 * system resources.
171 * 171 *
172 * An [IOSink] for a file can be opened in two modes: 172 * An [IOSink] for a file can be opened in two modes:
173 * 173 *
174 * * [FileMode.WRITE]: truncates the file to length zero. 174 * * [FileMode.WRITE]: truncates the file to length zero.
175 * * [FileMode.APPEND]: sets the initial write position to the end 175 * * [FileMode.APPEND]: sets the initial write position to the end
176 * of the file. 176 * of the file.
177 *
178 * When writing strings through the returned [IOSink] the encoding
179 * specified using [encoding] will be used. The returned [IOSink]
180 * has an [:encoding:] property which can be changed after the
181 * [IOSink] has been created.
177 */ 182 */
178 IOSink<File> openWrite([FileMode mode = FileMode.WRITE]); 183 IOSink<File> openWrite({FileMode mode: FileMode.WRITE,
184 Encoding encoding: Encoding.UTF_8});
Anders Johnsen 2013/03/07 16:53:49 Thinking about this API change, I'm EXTREMELY exci
Søren Gjesse 2013/03/08 09:47:46 Thanks.
179 185
180 /** 186 /**
181 * Read the entire file contents as a list of bytes. Returns a 187 * Read the entire file contents as a list of bytes. Returns a
182 * [:Future<List<int>>:] that completes with the list of bytes that 188 * [:Future<List<int>>:] that completes with the list of bytes that
183 * is the contents of the file. 189 * is the contents of the file.
184 */ 190 */
185 Future<List<int>> readAsBytes(); 191 Future<List<int>> readAsBytes();
186 192
187 /** 193 /**
188 * Synchronously read the entire file contents as a list of bytes. 194 * Synchronously read the entire file contents as a list of bytes.
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 sb.write(" ($osError)"); 468 sb.write(" ($osError)");
463 } 469 }
464 } else if (osError != null) { 470 } else if (osError != null) {
465 sb.write(": osError"); 471 sb.write(": osError");
466 } 472 }
467 return sb.toString(); 473 return sb.toString();
468 } 474 }
469 final String message; 475 final String message;
470 final OSError osError; 476 final OSError osError;
471 } 477 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698