OLD | NEW |
1 // Copyright (c) 2013, 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 { |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 * | 198 * |
199 * * [FileMode.WRITE]: truncates the file to length zero. | 199 * * [FileMode.WRITE]: truncates the file to length zero. |
200 * * [FileMode.APPEND]: sets the initial write position to the end | 200 * * [FileMode.APPEND]: sets the initial write position to the end |
201 * of the file. | 201 * of the file. |
202 * | 202 * |
203 * When writing strings through the returned [IOSink] the encoding | 203 * When writing strings through the returned [IOSink] the encoding |
204 * specified using [encoding] will be used. The returned [IOSink] | 204 * specified using [encoding] will be used. The returned [IOSink] |
205 * has an [:encoding:] property which can be changed after the | 205 * has an [:encoding:] property which can be changed after the |
206 * [IOSink] has been created. | 206 * [IOSink] has been created. |
207 */ | 207 */ |
208 IOSink<File> openWrite({FileMode mode: FileMode.WRITE, | 208 IOSink openWrite({FileMode mode: FileMode.WRITE, |
209 Encoding encoding: Encoding.UTF_8}); | 209 Encoding encoding: Encoding.UTF_8}); |
210 | 210 |
211 /** | 211 /** |
212 * Read the entire file contents as a list of bytes. Returns a | 212 * Read the entire file contents as a list of bytes. Returns a |
213 * [:Future<List<int>>:] that completes with the list of bytes that | 213 * [:Future<List<int>>:] that completes with the list of bytes that |
214 * is the contents of the file. | 214 * is the contents of the file. |
215 */ | 215 */ |
216 Future<List<int>> readAsBytes(); | 216 Future<List<int>> readAsBytes(); |
217 | 217 |
218 /** | 218 /** |
219 * Synchronously read the entire file contents as a list of bytes. | 219 * Synchronously read the entire file contents as a list of bytes. |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 sb.write(" ($osError)"); | 525 sb.write(" ($osError)"); |
526 } | 526 } |
527 } else if (osError != null) { | 527 } else if (osError != null) { |
528 sb.write(": osError"); | 528 sb.write(": osError"); |
529 } | 529 } |
530 return sb.toString(); | 530 return sb.toString(); |
531 } | 531 } |
532 final String message; | 532 final String message; |
533 final OSError osError; | 533 final OSError osError; |
534 } | 534 } |
OLD | NEW |