| 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 23 matching lines...) Expand all Loading... |
| 34 * this.[openWrite](). | 34 * this.[openWrite](). |
| 35 * * Open the file for random access operations using [open]. | 35 * * Open the file for random access operations using [open]. |
| 36 */ | 36 */ |
| 37 abstract class File implements FileSystemEntity { | 37 abstract class File implements FileSystemEntity { |
| 38 /** | 38 /** |
| 39 * Create a File object. | 39 * Create a File object. |
| 40 */ | 40 */ |
| 41 factory File(String path) => new _File(path); | 41 factory File(String path) => new _File(path); |
| 42 | 42 |
| 43 /** | 43 /** |
| 44 * Create a File object from a URI. |
| 45 * |
| 46 * If [uri] cannot reference a file this throws [UnsupportedError]. |
| 47 */ |
| 48 factory File.fromUri(Uri uri) => new File(uri.toFilePath()); |
| 49 |
| 50 /** |
| 44 * Create the file. Returns a [:Future<File>:] that completes with | 51 * Create the file. Returns a [:Future<File>:] that completes with |
| 45 * the file when it has been created. | 52 * the file when it has been created. |
| 46 * | 53 * |
| 47 * If [recursive] is false, the default, the file is created only if | 54 * If [recursive] is false, the default, the file is created only if |
| 48 * all directories in the path exist. If [recursive] is true, all | 55 * all directories in the path exist. If [recursive] is true, all |
| 49 * non-existing path components are created. | 56 * non-existing path components are created. |
| 50 * | 57 * |
| 51 * Existing files are left untouched by [create]. Calling [create] on an | 58 * Existing files are left untouched by [create]. Calling [create] on an |
| 52 * existing file might fail if there are restrictive permissions on | 59 * existing file might fail if there are restrictive permissions on |
| 53 * the file. | 60 * the file. |
| (...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 } | 532 } |
| 526 } else if (osError != null) { | 533 } else if (osError != null) { |
| 527 sb.write(": osError"); | 534 sb.write(": osError"); |
| 528 if (path != null) { | 535 if (path != null) { |
| 529 sb.write(", path = $path"); | 536 sb.write(", path = $path"); |
| 530 } | 537 } |
| 531 } | 538 } |
| 532 return sb.toString(); | 539 return sb.toString(); |
| 533 } | 540 } |
| 534 } | 541 } |
| OLD | NEW |