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 { |
| 11 /// The [FileMode] for opening a file only for reading. |
11 static const READ = const FileMode._internal(0); | 12 static const READ = const FileMode._internal(0); |
| 13 /// The [FileMode] for opening a file for reading and writing. The file will |
| 14 /// be overwritten. If the file does not exist, it will be created. |
12 static const WRITE = const FileMode._internal(1); | 15 static const WRITE = const FileMode._internal(1); |
| 16 /// The [FileMode] for opening a file for reading a file and writing to the |
| 17 /// end of it. If the file does not exist, it will be created. |
13 static const APPEND = const FileMode._internal(2); | 18 static const APPEND = const FileMode._internal(2); |
14 const FileMode._internal(int this._mode); | 19 const FileMode._internal(int this._mode); |
15 final int _mode; | 20 final int _mode; |
16 } | 21 } |
17 | 22 |
| 23 /// The [FileMode] for opening a file only for reading. |
18 const READ = FileMode.READ; | 24 const READ = FileMode.READ; |
| 25 /// The [FileMode] for opening a file for reading and writing. The file will be |
| 26 /// overwritten. If the file does not exist, it will be created. |
19 const WRITE = FileMode.WRITE; | 27 const WRITE = FileMode.WRITE; |
| 28 /// The [FileMode] for opening a file for reading a file and writing to the end |
| 29 /// of it. If the file does not exist, it will be created. |
20 const APPEND = FileMode.APPEND; | 30 const APPEND = FileMode.APPEND; |
21 | 31 |
22 /** | 32 /** |
23 * A reference to a file on the file system. | 33 * A reference to a file on the file system. |
24 * | 34 * |
25 * If [path] is a symbolic link, rather than a file, then | 35 * If [path] is a symbolic link, rather than a file, then |
26 * the methods of [File] operate on the ultimate target of the | 36 * the methods of [File] operate on the ultimate target of the |
27 * link, except for File.delete and File.deleteSync, which operate on | 37 * link, except for File.delete and File.deleteSync, which operate on |
28 * the link. | 38 * the link. |
29 * | 39 * |
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 } | 561 } |
552 } else if (osError != null) { | 562 } else if (osError != null) { |
553 sb.write(": osError"); | 563 sb.write(": osError"); |
554 if (path != null) { | 564 if (path != null) { |
555 sb.write(", path = $path"); | 565 sb.write(", path = $path"); |
556 } | 566 } |
557 } | 567 } |
558 return sb.toString(); | 568 return sb.toString(); |
559 } | 569 } |
560 } | 570 } |
OLD | NEW |