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 * The modes in which a File can be opened. | 8 * The modes in which a File can be opened. |
9 */ | 9 */ |
10 class FileMode { | 10 class FileMode { |
11 /// The mode for opening a file only for reading. | 11 /// The mode for opening a file only for reading. |
12 static const READ = const FileMode._internal(0); | 12 static const READ = const FileMode._internal(0); |
13 /// The mode for opening a file for reading and writing. The file is | 13 /// Mode for opening a file for reading and writing. The file is |
14 /// overwritten if it already exists. The file is created if it does not | 14 /// overwritten if it already exists. The file is created if it does not |
15 /// already exist. | 15 /// already exist. |
16 static const WRITE = const FileMode._internal(1); | 16 static const WRITE = const FileMode._internal(1); |
17 /// The mode for opening a file for reading and writing to the | 17 /// Mode for opening a file for reading and writing to the |
18 /// end of it. The file is created if it does not already exist. | 18 /// end of it. The file is created if it does not already exist. |
19 static const APPEND = const FileMode._internal(2); | 19 static const APPEND = const FileMode._internal(2); |
20 /// Mode for opening a file for writing *only*. The file is | |
21 /// overwritten if it already exists. The file is created if it does not | |
22 /// already exist. | |
23 static const WRITE_ONLY = const FileMode._internal(3); | |
24 /// Mode for opening a file for writing *only* to the | |
25 /// end of it. The file is created if it does not already exist. | |
26 static const WRITE_ONLY_APPEND = const FileMode._internal(4); | |
20 final int _mode; | 27 final int _mode; |
21 | 28 |
22 const FileMode._internal(this._mode); | 29 const FileMode._internal(this._mode); |
23 } | 30 } |
24 | 31 |
25 /// The mode for opening a file only for reading. | 32 /// The mode for opening a file only for reading. |
26 const READ = FileMode.READ; | 33 const READ = FileMode.READ; |
27 /// The mode for opening a file for reading and writing. The file is | 34 /// The mode for opening a file for reading and writing. The file is |
28 /// overwritten if it already exists. The file is created if it does not | 35 /// overwritten if it already exists. The file is created if it does not |
29 /// already exist. | 36 /// already exist. |
30 const WRITE = FileMode.WRITE; | 37 const WRITE = FileMode.WRITE; |
31 /// The mode for opening a file for reading and writing to the | 38 /// The mode for opening a file for reading and writing to the |
32 /// end of it. The file is created if it does not already exist. | 39 /// end of it. The file is created if it does not already exist. |
33 const APPEND = FileMode.APPEND; | 40 const APPEND = FileMode.APPEND; |
34 | 41 |
42 const WRITE_ONLY = FileMode.WRITE_ONLY; | |
Mads Ager (google)
2015/06/18 12:04:48
You should duplicate the doc comments here.
| |
43 | |
44 const WRITE_ONLY_APPEND = FileMode.WRITE_ONLY_APPEND; | |
45 | |
35 | 46 |
36 /// Type of lock when requesting a lock on a file. | 47 /// Type of lock when requesting a lock on a file. |
37 enum FileLock { | 48 enum FileLock { |
38 /// Shared file lock. | 49 /// Shared file lock. |
39 SHARED, | 50 SHARED, |
40 /// Exclusive file lock. | 51 /// Exclusive file lock. |
41 EXCLUSIVE | 52 EXCLUSIVE |
42 } | 53 } |
43 | 54 |
44 /** | 55 /** |
(...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
862 sb.write(": $osError"); | 873 sb.write(": $osError"); |
863 if (path != null) { | 874 if (path != null) { |
864 sb.write(", path = '$path'"); | 875 sb.write(", path = '$path'"); |
865 } | 876 } |
866 } else if (path != null) { | 877 } else if (path != null) { |
867 sb.write(": $path"); | 878 sb.write(": $path"); |
868 } | 879 } |
869 return sb.toString(); | 880 return sb.toString(); |
870 } | 881 } |
871 } | 882 } |
OLD | NEW |